Package de.danielkullmann.hackvm

Examples of de.danielkullmann.hackvm.HackVM.execute()


    result = vm.execute( "      c1!", "8", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 6 );

    result = vm.execute( "      $1!", "8", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 0 );

    result = vm.execute( "<", "1", null );
    assertNull( result.getError() );
View Full Code Here


    result = vm.execute( "      $1!", "8", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 0 );

    result = vm.execute( "<", "1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 0 );

    result = vm.execute( "><", "1, 2, 1", null );
View Full Code Here

    result = vm.execute( "<", "1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 0 );

    result = vm.execute( "><", "1, 2, 1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 2 );
   
    result = vm.execute( "^", "4, 0", null );
View Full Code Here

    result = vm.execute( "><", "1, 2, 1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 2 );
   
    result = vm.execute( "^", "4, 0", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 2 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 4 );
View Full Code Here

    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 2 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 4 );

    result = vm.execute( "^", "1, 2, 3, 4, 2", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 5 );
    assertTrue( result.getStack().pop() == 2 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
View Full Code Here

    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
    assertTrue( result.getStack().pop() == 2 );
    assertTrue( result.getStack().pop() == 1 );

    result = vm.execute( "v", "4, 0", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 4 );

    result = vm.execute( "v", "1, 2, 3, 4, 2", null );
View Full Code Here

    result = vm.execute( "v", "4, 0", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 1 );
    assertTrue( result.getStack().peek() == 4 );

    result = vm.execute( "v", "1, 2, 3, 4, 2", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 4 );
    assertTrue( result.getStack().pop() == 2 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
View Full Code Here

    assertTrue( result.getStack().pop() == 2 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
    assertTrue( result.getStack().pop() == 1 );
 
    result = vm.execute( "d", "1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 0 );

    result = vm.execute( "ddddd", "1, 2, 3, 4, 5, 6, 7, 8, 9", null );
    assertNull( result.getError() );
View Full Code Here

 
    result = vm.execute( "d", "1", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 0 );

    result = vm.execute( "ddddd", "1, 2, 3, 4, 5, 6, 7, 8, 9", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 4 );
    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
    assertTrue( result.getStack().pop() == 2 );
View Full Code Here

    assertTrue( result.getStack().pop() == 4 );
    assertTrue( result.getStack().pop() == 3 );
    assertTrue( result.getStack().pop() == 2 );
    assertTrue( result.getStack().pop() == 1 );

    result = vm.execute( "!11111", "", null );
    assertNull( result.getError() );
    assertTrue( result.getStack().size() == 0 );

    result = vm.execute( "11!111", "", null );
    assertNull( result.getError() );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.