Skip to content

Commit

Permalink
fix(tests): notation (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzogentile404 authored Sep 20, 2024
1 parent 2a0cbf5 commit 94d6f26
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class MessageFrameTest {

@Test
void TestCreate() {
void testCreate() {
// The pc is not updated as expected
// We do not execute the init code of the created smart contract
// TODO: fix this!
Expand All @@ -50,7 +50,7 @@ void TestCreate() {
}

@Test
void TestCall() {
void testCall() {
// Interestingly for CALL the pc is updated as expected
// We execute the bytecode of the called smart contract
BytecodeCompiler program = BytecodeCompiler.newProgram();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void testMul() {

/** For readability we write __ instead of 00 */
@Test
void TestIsTheBeefDeadYet() {
void testIsTheBeefDeadYet() {
BytecodeRunner.of(
BytecodeCompiler.newProgram()
.push("deadbeef") // 4 bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,31 @@
public class OobCallTest {

@Test
void TestCallSendValueGreaterThanBalanceHiNonZero() {
void testCallSendValueGreaterThanBalanceHiNonZero() {
final EWord balanceOfCaller = EWord.of(BigInteger.ONE);
final EWord amountToSend = EWord.of(BigInteger.ONE, BigInteger.ZERO);

testCallSendValue(balanceOfCaller, amountToSend, 1);
}

@Test
void TestCallSendValueGreaterThanBalanceLoNonZero() {
void testCallSendValueGreaterThanBalanceLoNonZero() {
final EWord balanceOfCaller = EWord.of(BigInteger.ONE);
final EWord amountToSend = EWord.of(BigInteger.ZERO, BigInteger.TWO);

testCallSendValue(balanceOfCaller, amountToSend, 1);
}

@Test
void TestCallSendValueGreaterThanBalanceHiLoNonZero() {
void testCallSendValueGreaterThanBalanceHiLoNonZero() {
final EWord balanceOfCaller = EWord.of(BigInteger.ONE);
final EWord amountToSend = EWord.of(BigInteger.TWO, BigInteger.TWO);

testCallSendValue(balanceOfCaller, amountToSend, 1);
}

@Test
void TestCallSendValueSmallerThanBalanceLoNonZero() {
void testCallSendValueSmallerThanBalanceLoNonZero() {
final EWord balanceOfCaller = EWord.of(BigInteger.TWO);
final EWord amountToSend = EWord.of(BigInteger.ZERO, BigInteger.ONE);

Expand All @@ -91,7 +91,7 @@ void testRecursiveCalls1025() {
}

@Test
void TestRecursiveCallsWithBytecode() {
void testRecursiveCallsWithBytecode() {
final BytecodeRunner bytecodeRunner =
BytecodeRunner.of(Bytes.fromHexString("60006000600060006000305af1"));
bytecodeRunner.run(Wei.fromEth(400), 0xFFFFFFL);
Expand All @@ -102,11 +102,11 @@ void TestRecursiveCallsWithBytecode() {
}

/**
* Same as {@link #TestRecursiveCallsWithBytecode()} but with an ADD opcode at the end triggering
* Same as {@link #testRecursiveCallsWithBytecode()} but with an ADD opcode at the end triggering
* SUX
*/
@Test
void TestRecursiveCallsWithBytecodeFollowedByStackUnderflow() {
void testRecursiveCallsWithBytecodeFollowedByStackUnderflow() {
final BytecodeRunner bytecodeRunner =
BytecodeRunner.of(Bytes.fromHexString("60006000600060006000305af101"));
bytecodeRunner.run(Wei.fromEth(400), 0xFFFFFFL);
Expand All @@ -116,9 +116,9 @@ void TestRecursiveCallsWithBytecodeFollowedByStackUnderflow() {
assertTrue(stackUnderflow(hub.pch().exceptions()));
}

/** Same as {@link #TestRecursiveCallsWithBytecode()} but with an ADDRESS opcode at the end */
/** Same as {@link #testRecursiveCallsWithBytecode()} but with an ADDRESS opcode at the end */
@Test
void TestRecursiveCallsWithBytecodeFollowedByAddress() {
void testRecursiveCallsWithBytecodeFollowedByAddress() {
final BytecodeRunner bytecodeRunner =
BytecodeRunner.of(Bytes.fromHexString("60006000600060006000305af130"));
bytecodeRunner.run(Wei.fromEth(400), (long) 21000 + 10000);
Expand All @@ -128,9 +128,9 @@ void TestRecursiveCallsWithBytecodeFollowedByAddress() {
assertTrue(Exceptions.none(hub.pch().exceptions()));
}

/** Same as {@link #TestRecursiveCallsWithBytecode()} but with an STOP opcode at the end */
/** Same as {@link #testRecursiveCallsWithBytecode()} but with an STOP opcode at the end */
@Test
void TestRecursiveCallsWithBytecodeFollowedByExplicitStop() {
void testRecursiveCallsWithBytecodeFollowedByExplicitStop() {
final BytecodeRunner bytecodeRunner =
BytecodeRunner.of(Bytes.fromHexString("60006000600060006000305af100"));
bytecodeRunner.run(Wei.fromEth(400), 0xFFFFFFL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OobJumpAndJumpiTest {
BigInteger.ONE.shiftLeft(128).subtract(BigInteger.ONE);

@Test
void TestJumpSequenceSuccessTrivial() {
void testJumpSequenceSuccessTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJump(EWord.of(35), program);
Expand Down Expand Up @@ -70,7 +70,7 @@ void TestJumpSequenceSuccessTrivial() {
}

@Test
void TestJumpSequenceSuccessBackAndForth() {
void testJumpSequenceSuccessBackAndForth() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJump(EWord.of(71), program);
Expand Down Expand Up @@ -98,7 +98,7 @@ void TestJumpSequenceSuccessBackAndForth() {
}

@Test
void TestJumpSequenceFailingNoJumpdestTrivial() {
void testJumpSequenceFailingNoJumpdestTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJump(EWord.of(35), program);
Expand All @@ -125,7 +125,7 @@ void TestJumpSequenceFailingNoJumpdestTrivial() {
}

@Test
void TestJumpSequenceFailingOobTrivial() {
void testJumpSequenceFailingOobTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJump(EWord.of(35), program);
Expand All @@ -152,7 +152,7 @@ void TestJumpSequenceFailingOobTrivial() {
}

@Test
void TestJumpSequenceSuccessRandom() {
void testJumpSequenceSuccessRandom() {
final int N_JUMPS = 200;
final int MAX_JUMPDESTINATION = 256;
final int SPREADING_FACTOR = 256;
Expand Down Expand Up @@ -198,7 +198,7 @@ void TestJumpSequenceSuccessRandom() {
}

@Test
void TestJumpSequenceSuccessRandomBackAndForth() {
void testJumpSequenceSuccessRandomBackAndForth() {
final int N_JUMPS = 200;
final int MAX_JUMPDESTINATION = 256;
final int SPREADING_FACTOR = 256;
Expand Down Expand Up @@ -248,7 +248,7 @@ void TestJumpSequenceSuccessRandomBackAndForth() {
}

@Test
void TestJumpiSequenceSuccessTrivial() {
void testJumpiSequenceSuccessTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJumpi(EWord.of(68), EWord.of(1), program);
Expand Down Expand Up @@ -276,7 +276,7 @@ void TestJumpiSequenceSuccessTrivial() {
}

@Test
void TestJumpiSequenceSuccessBackAndForth() {
void testJumpiSequenceSuccessBackAndForth() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJumpi(EWord.of(137), EWord.of(1), program);
Expand Down Expand Up @@ -304,7 +304,7 @@ void TestJumpiSequenceSuccessBackAndForth() {
}

@Test
void TestJumpiSequenceFailingNoJumpdestTrivial() {
void testJumpiSequenceFailingNoJumpdestTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJumpi(EWord.of(68), EWord.of(1), program);
Expand All @@ -331,7 +331,7 @@ void TestJumpiSequenceFailingNoJumpdestTrivial() {
}

@Test
void TestJumpiSequenceFailingOobTrivial() {
void testJumpiSequenceFailingOobTrivial() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJumpi(EWord.of(68), EWord.of(1), program);
Expand Down Expand Up @@ -359,7 +359,7 @@ void TestJumpiSequenceFailingOobTrivial() {
}

@Test
void TestNoJumpi() {
void testNoJumpi() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

appendJumpi(EWord.of(68), EWord.of(0), program); // jumpCondition is 0, that means no JUMPI
Expand All @@ -378,7 +378,7 @@ void TestNoJumpi() {
}

@Test
void TestJumpiHiNonZero() {
void testJumpiHiNonZero() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

EWord jumpCondition = EWord.of(TWO_POW_128_MINUS_ONE, BigInteger.ZERO);
Expand All @@ -398,7 +398,7 @@ void TestJumpiHiNonZero() {
}

@Test
void TestJumpiLoNonZero() {
void testJumpiLoNonZero() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

EWord jumpCondition = EWord.of(BigInteger.valueOf(0), TWO_POW_128_MINUS_ONE);
Expand All @@ -418,7 +418,7 @@ void TestJumpiLoNonZero() {
}

@Test
void TestJumpiHiLoNonZero() {
void testJumpiHiLoNonZero() {
BytecodeCompiler program = BytecodeCompiler.newProgram();

EWord jumpCondition = EWord.of(TWO_POW_128_MINUS_ONE, TWO_POW_128_MINUS_ONE);
Expand All @@ -438,7 +438,7 @@ void TestJumpiHiLoNonZero() {
}

@Test
void TestJumpiSequenceSuccessRandom() {
void testJumpiSequenceSuccessRandom() {
final int N_JUMPIS = 200;
final int MAX_JUMPDESTINATION = 256;
final int SPREADING_FACTOR = 256;
Expand Down Expand Up @@ -489,7 +489,7 @@ void TestJumpiSequenceSuccessRandom() {
}

@Test
void TestJumpiSequenceSuccessRandomBackAndForth() {
void testJumpiSequenceSuccessRandomBackAndForth() {
final int N_JUMPIS = 200;
final int MAX_JUMPDESTINATION = 256;
final int SPREADING_FACTOR = 256;
Expand Down
Loading

0 comments on commit 94d6f26

Please sign in to comment.