Пример #1
0
  public void testConstructor() {
    class __stub_memoryline extends MemoryLine {
      public __stub_memoryline() {
        super(1, "foo");
      }

      public int getBinary() {
        return 60;
      }
    }

    Application app;
    // The stub_memorylines always return 60 for their getBinary().
    __stub_memoryline[] foo = {new __stub_memoryline()};
    // Null variables should be replaced by empty actual variables
    // by the application.
    app = new Application(null, null, null);
    assertEquals(app.getCode().length, 0);
    assertEquals(app.getInitialData().length, 0);
    assertTrue(app.getSymbolTable() != null);
    // Then try one which has content.
    app = new Application(foo, foo, new SymbolTable());
    assertEquals("One-length code area", app.getCode().length, 1);
    assertEquals(app.getCode()[0].getBinary(), 60);
    assertEquals("One-length data area", app.getInitialData().length, 1);
    assertEquals(app.getInitialData()[0].getBinary(), 60);
    assertTrue(app.getSymbolTable() != null);
  }