Package org.ethereum.vm

Examples of org.ethereum.vm.DataWord


    assertEquals(expected, x.toString());
  }

  @Test
  public void testSignExtend2() {
    DataWord x = new DataWord(Hex.decode("f2"));
    byte k = 1;
    String expected = "00000000000000000000000000000000000000000000000000000000000000f2";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here


  @Test
  public void testSignExtend3() {

    byte k = 1;
    DataWord x = new DataWord(Hex.decode("0f00ab"));
    String expected = "00000000000000000000000000000000000000000000000000000000000000ab";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test
  public void testSignExtend4() {

    byte k = 1;
    DataWord x = new DataWord(Hex.decode("ffff"));
    String expected = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test
  public void testSignExtend5() {

    byte k = 3;
    DataWord x = new DataWord(Hex.decode("ffffffff"));
    String expected = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test
  public void testSignExtend6() {

    byte k = 3;
    DataWord x = new DataWord(Hex.decode("ab02345678"));
    String expected = "0000000000000000000000000000000000000000000000000000000002345678";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test
  public void testSignExtend7() {

    byte k = 3;
    DataWord x = new DataWord(Hex.decode("ab82345678"));
    String expected = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff82345678";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test
  public void testSignExtend8() {

    byte k = 30;
    DataWord x = new DataWord(Hex.decode("ff34567882345678823456788234567882345678823456788234567882345678"));
    String expected = "0034567882345678823456788234567882345678823456788234567882345678";

    x.signExtend(k);
    System.out.println(x.toString());
    assertEquals(expected, x.toString());
  }
View Full Code Here

  @Test(expected=IndexOutOfBoundsException.class)
  public void testSignExtendException1() {

    byte k = -1;
    DataWord x = new DataWord();

    x.signExtend(k); // should throw an exception
  }
View Full Code Here

 
  @Test(expected=IndexOutOfBoundsException.class)
  public void testSignExtendException2() {

    byte k = 32;
    DataWord x = new DataWord();

    x.signExtend(k); // should throw an exception
  }
View Full Code Here

        program = new Program(Hex.decode("36"), invoke);
        String s_expected_1 = "0000000000000000000000000000000000000000000000000000000000000040";

        vm.step(program);

        DataWord item1 = program.stackPop();
        assertEquals(s_expected_1, Hex.toHexString(item1.getData()).toUpperCase());
    }
View Full Code Here

TOP

Related Classes of org.ethereum.vm.DataWord

Copyright © 2018 www.massapicom. 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.