public void testDump() throws IOException {
    FInt three = FInt.make(3);
    FInt a = FInt.make((int) '$');
    FInt b = FInt.make((int) 'K');
    FInt c = FInt.make((int) 'l');

    testCompiledEnv.putValueRaw("run", three);
    testCompiledEnv.putValueRaw("$", a);
    testCompiledEnv.putValueRaw("K", b);
    testCompiledEnv.putValueRaw("l", c);

    StringBuilder buffer = new StringBuilder();
    testCompiledEnv.verboseDump = true;
    testCompiledEnv.dump(buffer);
  }
  public void testGetPutApiInNestedDir()
      throws IOException, InstantiationException, IllegalAccessException {
    FInt level = FInt.make(1);

    assertNull(testCompiledNestedImportEnv.getApiNull(fsiFiles[1]));
    assertNull(testCompiledNestedImportEnv.getApiNull(fsiFiles[2]));
    assertNull(testCompiledNestedImportEnv.getApiNull("NonExistentApi"));

    Environment loadedLevel1Api = SimpleClassLoader.loadEnvironment(fsiFiles[1], true);
    Environment loadedLevel2Api = SimpleClassLoader.loadEnvironment(fsiFiles[2], true);
    testCompiledNestedImportEnv.putApi(fsiFiles[1], loadedLevel1Api);
    testCompiledNestedImportEnv.putApi(fsiFiles[2], loadedLevel2Api);

    Environment env1 = testCompiledNestedImportEnv.getApiNull(fsiFiles[1]);
    Environment env2 = testCompiledNestedImportEnv.getApiNull(fsiFiles[2]);

    assertEquals(loadedLevel1Api, env1);
    assertEquals(loadedLevel2Api, env2);

    env1.putValueRaw("level1", level);
    env2.putValueRaw("level2", level);

    assertEquals(level, loadedLevel1Api.getRootValueNull("level1"));
    assertEquals(level, loadedLevel2Api.getRootValueNull("level2"));
  }
  public void testGetPutValueRaw() {

    FInt three = FInt.make(3);
    FInt seven = FInt.make(7);
    FInt thirteen = FInt.make(13);
    FInt a = FInt.make((int) '$');
    FInt b = FInt.make((int) 'K');
    FInt c = FInt.make((int) 'l');

    testCompiledEnv.putValueRaw("run", three);
    testCompiledEnv.putValueRaw("$", a);
    testCompiledEnv.putValueRaw("K", b);
    testCompiledEnv.putValueRaw("l", c);

    // Now test hash collisions
    testCompiledEnv.putValueRaw("Aa", seven);
    testCompiledEnv.putValueRaw("BB", thirteen);

    assertEquals(testCompiledEnv.getValueRaw("run"), three);
    assertEquals(testCompiledEnv.getValueRaw("$"), a);
    assertEquals(testCompiledEnv.getValueRaw("K"), b);
    assertEquals(testCompiledEnv.getValueRaw("l"), c);

    assertEquals(testCompiledEnv.getValueRaw("Aa"), seven);
    assertEquals(testCompiledEnv.getValueRaw("BB"), thirteen);
    assertNull(testCompiledEnv.getValueRaw("Chupacabra"));
  }
  public void testRemoveMethods() {
    IntNat three = IntNat.make(3);
    testCompiledEnv.putTypeRaw("Empty", three);
    assertEquals(testCompiledEnv.getLeafTypeNull("Empty"), three); // leaf
    testCompiledEnv.removeType("Empty");
    assertNull(testCompiledEnv.getLeafTypeNull("Empty")); // leaf

    FInt seven = FInt.make(7);

    testCompiledEnv.putValueRaw("run", seven);
    assertEquals(testCompiledEnv.getValueRaw("run"), seven);
    testCompiledEnv.removeVar("run");
    assertNull(testCompiledEnv.getValueRaw("run"));
  }
  public void testGetPutApi() throws IOException, InstantiationException, IllegalAccessException {
    FInt val = FInt.make(65);
    String apiName = fsiFiles[0];

    assertNull(testCompiledImportEnv.getApiNull(apiName));
    Environment loadedEnv = SimpleClassLoader.loadEnvironment(fsiFiles[0], true);
    testCompiledImportEnv.putApi(apiName, loadedEnv);
    Environment env = testCompiledImportEnv.getApiNull(apiName);
    assertEquals(loadedEnv, env);

    testLibraryEnv.putValue("false", val);
    env.putValueRaw("A", val);
    assertEquals(val, loadedEnv.getRootValueNull("A"));
  }