@@ -31,8 +31,8 @@ abstract contract HelperAssert is HelperBase {
3131 if (a != b) {
3232 string memory aStr = FuzzLibString.toString (a);
3333 string memory bStr = FuzzLibString.toString (b);
34- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
35- emit AssertEqFail (string ( assertMsg) );
34+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
35+ emit AssertEqFail (assertMsg);
3636 platform.assertFail ();
3737 }
3838 }
@@ -46,8 +46,8 @@ abstract contract HelperAssert is HelperBase {
4646 if (a != b) {
4747 string memory aStr = FuzzLibString.toString (a);
4848 string memory bStr = FuzzLibString.toString (b);
49- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
50- emit AssertEqFail (string ( assertMsg) );
49+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
50+ emit AssertEqFail (assertMsg);
5151 platform.assertFail ();
5252 }
5353 }
@@ -61,8 +61,8 @@ abstract contract HelperAssert is HelperBase {
6161 if (a != b) {
6262 string memory aStr = a ? "true " : "false " ;
6363 string memory bStr = b ? "true " : "false " ;
64- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
65- emit AssertEqFail (string ( assertMsg) );
64+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
65+ emit AssertEqFail (assertMsg);
6666 platform.assertFail ();
6767 }
6868 }
@@ -76,8 +76,8 @@ abstract contract HelperAssert is HelperBase {
7676 if (a != b) {
7777 string memory aStr = FuzzLibString.toString (a);
7878 string memory bStr = FuzzLibString.toString (b);
79- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
80- emit AssertEqFail (string ( assertMsg) );
79+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
80+ emit AssertEqFail (assertMsg);
8181 platform.assertFail ();
8282 }
8383 }
@@ -93,8 +93,8 @@ abstract contract HelperAssert is HelperBase {
9393 bytes memory bBytes = abi.encodePacked (b);
9494 string memory aStr = FuzzLibString.toHexString (aBytes);
9595 string memory bStr = FuzzLibString.toHexString (bBytes);
96- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
97- emit AssertEqFail (string ( assertMsg) );
96+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "!= " , reason);
97+ emit AssertEqFail (assertMsg);
9898 platform.assertFail ();
9999 }
100100 }
@@ -108,8 +108,8 @@ abstract contract HelperAssert is HelperBase {
108108 if (a == b) {
109109 string memory aStr = FuzzLibString.toString (a);
110110 string memory bStr = FuzzLibString.toString (b);
111- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "== " , reason);
112- emit AssertNeqFail (string ( assertMsg) );
111+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "== " , reason);
112+ emit AssertNeqFail (assertMsg);
113113 platform.assertFail ();
114114 }
115115 }
@@ -123,8 +123,8 @@ abstract contract HelperAssert is HelperBase {
123123 if (a == b) {
124124 string memory aStr = FuzzLibString.toString (a);
125125 string memory bStr = FuzzLibString.toString (b);
126- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "== " , reason);
127- emit AssertNeqFail (string ( assertMsg) );
126+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "== " , reason);
127+ emit AssertNeqFail (assertMsg);
128128 platform.assertFail ();
129129 }
130130 }
@@ -138,8 +138,8 @@ abstract contract HelperAssert is HelperBase {
138138 if (! (a >= b)) {
139139 string memory aStr = FuzzLibString.toString (a);
140140 string memory bStr = FuzzLibString.toString (b);
141- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "< " , reason);
142- emit AssertGteFail (string ( assertMsg) );
141+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "< " , reason);
142+ emit AssertGteFail (assertMsg);
143143 platform.assertFail ();
144144 }
145145 }
@@ -153,8 +153,8 @@ abstract contract HelperAssert is HelperBase {
153153 if (! (a >= b)) {
154154 string memory aStr = FuzzLibString.toString (a);
155155 string memory bStr = FuzzLibString.toString (b);
156- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "< " , reason);
157- emit AssertGteFail (string ( assertMsg) );
156+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "< " , reason);
157+ emit AssertGteFail (assertMsg);
158158 platform.assertFail ();
159159 }
160160 }
@@ -168,8 +168,8 @@ abstract contract HelperAssert is HelperBase {
168168 if (! (a > b)) {
169169 string memory aStr = FuzzLibString.toString (a);
170170 string memory bStr = FuzzLibString.toString (b);
171- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, "<= " , reason);
172- emit AssertGtFail (string ( assertMsg) );
171+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "<= " , reason);
172+ emit AssertGtFail (assertMsg);
173173 platform.assertFail ();
174174 }
175175 }
@@ -183,15 +183,8 @@ abstract contract HelperAssert is HelperBase {
183183 if (! (a > b)) {
184184 string memory aStr = FuzzLibString.toString (a);
185185 string memory bStr = FuzzLibString.toString (b);
186- bytes memory assertMsg = abi.encodePacked (
187- "Invalid: " ,
188- aStr,
189- "<= " ,
190- bStr,
191- " failed, reason: " ,
192- reason
193- );
194- emit AssertGtFail (string (assertMsg));
186+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "<= " , reason);
187+ emit AssertGtFail (assertMsg);
195188 platform.assertFail ();
196189 }
197190 }
@@ -205,15 +198,8 @@ abstract contract HelperAssert is HelperBase {
205198 if (! (a <= b)) {
206199 string memory aStr = FuzzLibString.toString (a);
207200 string memory bStr = FuzzLibString.toString (b);
208- bytes memory assertMsg = abi.encodePacked (
209- "Invalid: " ,
210- aStr,
211- "> " ,
212- bStr,
213- " failed, reason: " ,
214- reason
215- );
216- emit AssertLteFail (string (assertMsg));
201+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "> " , reason);
202+ emit AssertLteFail (assertMsg);
217203 platform.assertFail ();
218204 }
219205 }
@@ -227,15 +213,8 @@ abstract contract HelperAssert is HelperBase {
227213 if (! (a <= b)) {
228214 string memory aStr = FuzzLibString.toString (a);
229215 string memory bStr = FuzzLibString.toString (b);
230- bytes memory assertMsg = abi.encodePacked (
231- "Invalid: " ,
232- aStr,
233- "> " ,
234- bStr,
235- " failed, reason: " ,
236- reason
237- );
238- emit AssertLteFail (string (assertMsg));
216+ string memory assertMsg = createAssertFailMessage (aStr, bStr, "> " , reason);
217+ emit AssertLteFail (assertMsg);
239218 platform.assertFail ();
240219 }
241220 }
@@ -249,8 +228,8 @@ abstract contract HelperAssert is HelperBase {
249228 if (! (a < b)) {
250229 string memory aStr = FuzzLibString.toString (a);
251230 string memory bStr = FuzzLibString.toString (b);
252- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, ">= " , reason);
253- emit AssertLtFail (string ( assertMsg) );
231+ string memory assertMsg = createAssertFailMessage (aStr, bStr, ">= " , reason);
232+ emit AssertLtFail (assertMsg);
254233 platform.assertFail ();
255234 }
256235 }
@@ -264,8 +243,8 @@ abstract contract HelperAssert is HelperBase {
264243 if (! (a < b)) {
265244 string memory aStr = FuzzLibString.toString (a);
266245 string memory bStr = FuzzLibString.toString (b);
267- bytes memory assertMsg = createAssertFailMessage (aStr, bStr, ">= " , reason);
268- emit AssertLtFail (string ( assertMsg) );
246+ string memory assertMsg = createAssertFailMessage (aStr, bStr, ">= " , reason);
247+ emit AssertLtFail (assertMsg);
269248 platform.assertFail ();
270249 }
271250 }
@@ -371,8 +350,8 @@ abstract contract HelperAssert is HelperBase {
371350 t (allowed, messages[passIndex]);
372351 }
373352
374- function createAssertFailMessage (string memory aStr , string memory bStr , string memory operator , string memory reason )internal pure returns (bytes memory ) {
375- return bytes (abi.encodePacked ("Invalid: " , aStr, operator, bStr, ", reason: " , reason));
353+ function createAssertFailMessage (string memory aStr , string memory bStr , string memory operator , string memory reason )internal pure returns (string memory ) {
354+ return string (abi.encodePacked ("Invalid: " , aStr, operator, bStr, ", reason: " , reason));
376355 }
377356
378357}
0 commit comments