From 91f93de2ad242a3a543a7c186f9b7afbae1f969b Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Fri, 22 Sep 2023 17:09:44 -0300 Subject: [PATCH] Rename test cases --- .../forLoop/isSimpleCounterLoop.sol | 155 +++++++++--------- 1 file changed, 74 insertions(+), 81 deletions(-) diff --git a/test/libsolidity/astPropertyTests/forLoop/isSimpleCounterLoop.sol b/test/libsolidity/astPropertyTests/forLoop/isSimpleCounterLoop.sol index 624a79312..61c2b8ffc 100644 --- a/test/libsolidity/astPropertyTests/forLoop/isSimpleCounterLoop.sol +++ b/test/libsolidity/astPropertyTests/forLoop/isSimpleCounterLoop.sol @@ -28,160 +28,153 @@ contract C { } function f() public { - /// PositiveCase1: isSimpleCounterLoop + // Positive Cases + /// SimplePreIncrement: isSimpleCounterLoop for(uint i = 0; i < 42; ++i) { } - /// PositiveCase2: isSimpleCounterLoop + /// SimplePosIncrement: isSimpleCounterLoop for(int i = 0; i < 42; i++) { } uint x; - /// PositiveCase3: isSimpleCounterLoop + /// CounterReadLoopBody: isSimpleCounterLoop for(uint i = 0; i < 42; i++) { x = i; } - /// PositiveCase4: isSimpleCounterLoop + /// LocalVarConditionRHS: isSimpleCounterLoop for(uint i = 0; i < x; i++) { } uint[8] memory array; - /// PositiveCase5: isSimpleCounterLoop + /// StaticArrayLengthConditionRHS: isSimpleCounterLoop for(uint i = 0; i < array.length; i++) { } dynArray.push(); - /// PositiveCase6: isSimpleCounterLoop + /// DynamicArrayLengthConditionRHS: isSimpleCounterLoop for(uint i = 0; i < dynArray.length; i++) { dynArray.push(i); } - /// PositiveCase7: isSimpleCounterLoop + /// CounterReadInlineAssembly: isSimpleCounterLoop for(uint i = 0; i < 42; ++i) { assembly { x := i } } - /// PositiveCase8: isSimpleCounterLoop + /// BinaryOperationConditionRHS: isSimpleCounterLoop for(uint i = 0; i < i + 1; i++) { } - /// PositiveCase9: isSimpleCounterLoop + /// FreeFunctionConditionRHS: isSimpleCounterLoop for(uint i = 0; i < h(); ++i) { } - /// NegativeCase1: isSimpleCounterLoop + // Negative Cases + /// AdditionLoopExpression: isSimpleCounterLoop for(uint i = 0; i < 42; i = i + 1) { } - /// NegativeCase2: isSimpleCounterLoop + /// SimplePreDecrement: isSimpleCounterLoop for(uint i = 42; i > 0; --i) { } - /// NegativeCase3: isSimpleCounterLoop + /// SimplePosDecrement: isSimpleCounterLoop for(uint i = 42; i > 0; i--) { } - /// NegativeCase4: isSimpleCounterLoop + /// MultiplicationLoopExpression: isSimpleCounterLoop for(uint i = 1; i < 42; i = i * 2) { } - /// NegativeCase5: isSimpleCounterLoop + /// CounterIncrementLoopBody: isSimpleCounterLoop for(uint i = 0; i < 42; ++i) { i++; } - /// NegativeCase6: isSimpleCounterLoop + /// CounterAssignmentLoopBody: isSimpleCounterLoop for(uint i = 0; i < 42; ++i) { i = 43; } - /// NegativeCase7: isSimpleCounterLoop + /// CounterAssignmentInlineAssemblyLoopBody: isSimpleCounterLoop for(uint i = 0; i < 42; ++i) { assembly { i := add(i, 1) } } uint j = type(uint).max; - /// NegativeCase8: isSimpleCounterLoop + /// ExternalCounterLoopExpression: isSimpleCounterLoop for (uint i = 0; i < 10; ++j) { } - /// NegativeCase9: isSimpleCounterLoop + /// CounterIncrementRHSAssignment: isSimpleCounterLoop for(uint i = 0; i < 10; ++i) { x = i++; } - /// NegativeCase10: isSimpleCounterLoop + /// NoEffectLoopExpression: isSimpleCounterLoop for(uint i = 0; i < 42; i) { } - uint y = type(uint8).max + 1; - /// NegativeCase11: isSimpleCounterLoop - for(uint8 i = 0; i < y; ++i) { - } - /// NegativeCase12: isSimpleCounterLoop + /// EmptyLoopExpression: isSimpleCounterLoop 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) { } - /// NegativeCase14: isSimpleCounterLoop + /// ComplexExpressionCondition: isSimpleCounterLoop for(uint i = 0; (i < 10 || g()); ++i) { } - /// NegativeCase15: isSimpleCounterLoop + /// FreeFunctionConditionLHS: isSimpleCounterLoop 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) { } - /// NegativeCase17: isSimpleCounterLoop + /// UDVTOperators: isSimpleCounterLoop for(UINT i = UINT.wrap(0); i < UINT.wrap(10); i = i + UINT.wrap(1)) { } - /// NegativeCase18: isSimpleCounterLoop - for(uint i = 0; i < 42; ++i) { - i = 43; - } - /// NegativeCase19: isSimpleCounterLoop + /// CounterAssignmentConditionRHS: isSimpleCounterLoop for(uint i = 0; i < (i = i + 1); ++i) { } - /// NegativeCase20: isSimpleCounterLoop + /// LiteralDifferentCommonTypeConditionRHS: isSimpleCounterLoop for(uint8 i = 0; i < 257 ; ++i) { } - /// NegativeCase21: isSimpleCounterLoop - for(uint8 i = 0; i < h(); ++i) { - } - /// NegativeCase22: isSimpleCounterLoop + /// StateVarCounterModifiedFunctionConditionRHS: isSimpleCounterLoop 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)) { } - uint16 w = 512; - /// NegativeCase24: isSimpleCounterLoop - for(uint8 i = 0; i < w; ++i) { - } - /// NegativeCase25: isSimpleCounterLoop - for(uint8 i = 0; i < h(); ++i) { - } } } // ---- -// PositiveCase1: true -// PositiveCase2: true -// PositiveCase3: true -// PositiveCase4: true -// PositiveCase5: true -// PositiveCase6: true -// PositiveCase7: true -// PositiveCase8: true -// PositiveCase9: true -// NegativeCase1: false -// NegativeCase2: false -// NegativeCase3: false -// NegativeCase4: false -// NegativeCase5: false -// NegativeCase6: false -// NegativeCase7: false -// NegativeCase8: false -// NegativeCase9: false -// NegativeCase10: false -// NegativeCase11: false -// NegativeCase12: false -// NegativeCase13: false -// NegativeCase14: false -// NegativeCase15: false -// NegativeCase16: false -// NegativeCase17: false -// NegativeCase18: false -// NegativeCase19: true -// NegativeCase20: false -// NegativeCase21: false -// NegativeCase22: true -// NegativeCase23: false -// NegativeCase24: false -// NegativeCase25: false +// SimplePreIncrement: true +// SimplePosIncrement: true +// CounterReadLoopBody: true +// LocalVarConditionRHS: true +// StaticArrayLengthConditionRHS: true +// DynamicArrayLengthConditionRHS: true +// CounterReadInlineAssembly: true +// BinaryOperationConditionRHS: true +// FreeFunctionConditionRHS: true +// AdditionLoopExpression: false +// SimplePreDecrement: false +// SimplePosDecrement: false +// MultiplicationLoopExpression: false +// CounterIncrementLoopBody: false +// CounterAssignmentLoopBody: false +// CounterAssignmentInlineAssemblyLoopBody: false +// ExternalCounterLoopExpression: false +// CounterIncrementRHSAssignment: false +// NoEffectLoopExpression: false +// DifferentCommonTypeCondition: false +// EmptyLoopExpression: false +// LessThanOrEqualCondition: false +// ComplexExpressionCondition: false +// FreeFunctionConditionLHS: false +// FreeFunctionConditionDifferentCommonTypeLHS: false +// NonIntegerTypeCondition: false +// UDVTOperators: false +// CounterAssignmentConditionRHS: true +// LiteralDifferentCommonTypeConditionRHS: false +// StateVarCounterModifiedFunctionConditionRHS: true +// StateVarCounterModifiedFunctionLoopBody: true +// NonIntegerCounter: false