Rename test cases

This commit is contained in:
Matheus Aguiar 2023-09-22 17:09:44 -03:00
parent fb24ddf233
commit 91f93de2ad

View File

@ -28,160 +28,153 @@ contract C {
} }
function f() public { function f() public {
/// PositiveCase1: isSimpleCounterLoop // Positive Cases
/// SimplePreIncrement: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) { for(uint i = 0; i < 42; ++i) {
} }
/// PositiveCase2: isSimpleCounterLoop /// SimplePosIncrement: isSimpleCounterLoop
for(int i = 0; i < 42; i++) { for(int i = 0; i < 42; i++) {
} }
uint x; uint x;
/// PositiveCase3: isSimpleCounterLoop /// CounterReadLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; i++) { for(uint i = 0; i < 42; i++) {
x = i; x = i;
} }
/// PositiveCase4: isSimpleCounterLoop /// LocalVarConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < x; i++) { for(uint i = 0; i < x; i++) {
} }
uint[8] memory array; uint[8] memory array;
/// PositiveCase5: isSimpleCounterLoop /// StaticArrayLengthConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < array.length; i++) { for(uint i = 0; i < array.length; i++) {
} }
dynArray.push(); dynArray.push();
/// PositiveCase6: isSimpleCounterLoop /// DynamicArrayLengthConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < dynArray.length; i++) { for(uint i = 0; i < dynArray.length; i++) {
dynArray.push(i); dynArray.push(i);
} }
/// PositiveCase7: isSimpleCounterLoop /// CounterReadInlineAssembly: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) { for(uint i = 0; i < 42; ++i) {
assembly { assembly {
x := i x := i
} }
} }
/// PositiveCase8: isSimpleCounterLoop /// BinaryOperationConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < i + 1; i++) { for(uint i = 0; i < i + 1; i++) {
} }
/// PositiveCase9: isSimpleCounterLoop /// FreeFunctionConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < h(); ++i) { for(uint i = 0; i < h(); ++i) {
} }
/// NegativeCase1: isSimpleCounterLoop // Negative Cases
/// AdditionLoopExpression: isSimpleCounterLoop
for(uint i = 0; i < 42; i = i + 1) { for(uint i = 0; i < 42; i = i + 1) {
} }
/// NegativeCase2: isSimpleCounterLoop /// SimplePreDecrement: isSimpleCounterLoop
for(uint i = 42; i > 0; --i) { for(uint i = 42; i > 0; --i) {
} }
/// NegativeCase3: isSimpleCounterLoop /// SimplePosDecrement: isSimpleCounterLoop
for(uint i = 42; i > 0; i--) { for(uint i = 42; i > 0; i--) {
} }
/// NegativeCase4: isSimpleCounterLoop /// MultiplicationLoopExpression: isSimpleCounterLoop
for(uint i = 1; i < 42; i = i * 2) { for(uint i = 1; i < 42; i = i * 2) {
} }
/// NegativeCase5: isSimpleCounterLoop /// CounterIncrementLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) { for(uint i = 0; i < 42; ++i) {
i++; i++;
} }
/// NegativeCase6: isSimpleCounterLoop /// CounterAssignmentLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) { for(uint i = 0; i < 42; ++i) {
i = 43; i = 43;
} }
/// NegativeCase7: isSimpleCounterLoop /// CounterAssignmentInlineAssemblyLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) { for(uint i = 0; i < 42; ++i) {
assembly { assembly {
i := add(i, 1) i := add(i, 1)
} }
} }
uint j = type(uint).max; uint j = type(uint).max;
/// NegativeCase8: isSimpleCounterLoop /// ExternalCounterLoopExpression: isSimpleCounterLoop
for (uint i = 0; i < 10; ++j) { for (uint i = 0; i < 10; ++j) {
} }
/// NegativeCase9: isSimpleCounterLoop /// CounterIncrementRHSAssignment: isSimpleCounterLoop
for(uint i = 0; i < 10; ++i) { for(uint i = 0; i < 10; ++i) {
x = i++; x = i++;
} }
/// NegativeCase10: isSimpleCounterLoop /// NoEffectLoopExpression: isSimpleCounterLoop
for(uint i = 0; i < 42; i) { for(uint i = 0; i < 42; i) {
} }
uint y = type(uint8).max + 1; /// EmptyLoopExpression: isSimpleCounterLoop
/// NegativeCase11: isSimpleCounterLoop
for(uint8 i = 0; i < y; ++i) {
}
/// NegativeCase12: isSimpleCounterLoop
for(uint i = 0; i < 10; ) { for(uint i = 0; i < 10; ) {
} }
/// NegativeCase13: isSimpleCounterLoop uint y = type(uint8).max + 1;
/// DifferentCommonTypeCondition: isSimpleCounterLoop
for(uint8 i = 0; i < y; ++i) {
}
/// LessThanOrEqualCondition: isSimpleCounterLoop
for(uint i = 0; i <= 10; ++i) { for(uint i = 0; i <= 10; ++i) {
} }
/// NegativeCase14: isSimpleCounterLoop /// ComplexExpressionCondition: isSimpleCounterLoop
for(uint i = 0; (i < 10 || g()); ++i) { for(uint i = 0; (i < 10 || g()); ++i) {
} }
/// NegativeCase15: isSimpleCounterLoop /// FreeFunctionConditionLHS: isSimpleCounterLoop
for(uint i = 0; h() < 100; ++i) { for(uint i = 0; h() < 100; ++i) {
} }
/// NegativeCase16: isSimpleCounterLoop /// FreeFunctionConditionDifferentCommonTypeLHS: isSimpleCounterLoop
for(uint8 i = 0; i < h(); ++i) {
}
/// NonIntegerTypeCondition: isSimpleCounterLoop
for(uint i = 0; address(this) < msg.sender; ++i) { for(uint i = 0; address(this) < msg.sender; ++i) {
} }
/// NegativeCase17: isSimpleCounterLoop /// UDVTOperators: isSimpleCounterLoop
for(UINT i = UINT.wrap(0); i < UINT.wrap(10); i = i + UINT.wrap(1)) { for(UINT i = UINT.wrap(0); i < UINT.wrap(10); i = i + UINT.wrap(1)) {
} }
/// NegativeCase18: isSimpleCounterLoop /// CounterAssignmentConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
i = 43;
}
/// NegativeCase19: isSimpleCounterLoop
for(uint i = 0; i < (i = i + 1); ++i) { for(uint i = 0; i < (i = i + 1); ++i) {
} }
/// NegativeCase20: isSimpleCounterLoop /// LiteralDifferentCommonTypeConditionRHS: isSimpleCounterLoop
for(uint8 i = 0; i < 257 ; ++i) { for(uint8 i = 0; i < 257 ; ++i) {
} }
/// NegativeCase21: isSimpleCounterLoop /// StateVarCounterModifiedFunctionConditionRHS: isSimpleCounterLoop
for(uint8 i = 0; i < h(); ++i) {
}
/// NegativeCase22: isSimpleCounterLoop
for (z = 1; z < modifyStateVarZ(); ++z) { for (z = 1; z < modifyStateVarZ(); ++z) {
} }
/// NegativeCase23: isSimpleCounterLoop /// StateVarCounterModifiedFunctionLoopBody: isSimpleCounterLoop
for (z = 1; z < 2048; ++z) {
modifyStateVarZ();
}
/// NonIntegerCounter: isSimpleCounterLoop
for (address i = address(0x123); i < address(this); i = address(0x123 + 1)) { for (address i = address(0x123); i < address(this); i = address(0x123 + 1)) {
} }
uint16 w = 512;
/// NegativeCase24: isSimpleCounterLoop
for(uint8 i = 0; i < w; ++i) {
}
/// NegativeCase25: isSimpleCounterLoop
for(uint8 i = 0; i < h(); ++i) {
}
} }
} }
// ---- // ----
// PositiveCase1: true // SimplePreIncrement: true
// PositiveCase2: true // SimplePosIncrement: true
// PositiveCase3: true // CounterReadLoopBody: true
// PositiveCase4: true // LocalVarConditionRHS: true
// PositiveCase5: true // StaticArrayLengthConditionRHS: true
// PositiveCase6: true // DynamicArrayLengthConditionRHS: true
// PositiveCase7: true // CounterReadInlineAssembly: true
// PositiveCase8: true // BinaryOperationConditionRHS: true
// PositiveCase9: true // FreeFunctionConditionRHS: true
// NegativeCase1: false // AdditionLoopExpression: false
// NegativeCase2: false // SimplePreDecrement: false
// NegativeCase3: false // SimplePosDecrement: false
// NegativeCase4: false // MultiplicationLoopExpression: false
// NegativeCase5: false // CounterIncrementLoopBody: false
// NegativeCase6: false // CounterAssignmentLoopBody: false
// NegativeCase7: false // CounterAssignmentInlineAssemblyLoopBody: false
// NegativeCase8: false // ExternalCounterLoopExpression: false
// NegativeCase9: false // CounterIncrementRHSAssignment: false
// NegativeCase10: false // NoEffectLoopExpression: false
// NegativeCase11: false // DifferentCommonTypeCondition: false
// NegativeCase12: false // EmptyLoopExpression: false
// NegativeCase13: false // LessThanOrEqualCondition: false
// NegativeCase14: false // ComplexExpressionCondition: false
// NegativeCase15: false // FreeFunctionConditionLHS: false
// NegativeCase16: false // FreeFunctionConditionDifferentCommonTypeLHS: false
// NegativeCase17: false // NonIntegerTypeCondition: false
// NegativeCase18: false // UDVTOperators: false
// NegativeCase19: true // CounterAssignmentConditionRHS: true
// NegativeCase20: false // LiteralDifferentCommonTypeConditionRHS: false
// NegativeCase21: false // StateVarCounterModifiedFunctionConditionRHS: true
// NegativeCase22: true // StateVarCounterModifiedFunctionLoopBody: true
// NegativeCase23: false // NonIntegerCounter: false
// NegativeCase24: false
// NegativeCase25: false