GNSPS / solidity-bytes-utils

Utility Solidity library composed of basic operations for tightly packed bytes arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

concatStorage test data repeats itself instead of varying by case

niran opened this issue · comments

In the tests, the results for concatenating with storageBytes31 are always the same as with storageBytes32 and storageBytes70, among others.

    storageBytes4.concatStorage(memBytes4);
    testBytes = hex"f00dfeedf00dfeed";
    AssertBytes.equalStorage(storageBytes4, testBytes, "storageBytes4 + memBytes4 concatenation failed.");

    storageBytes31.concatStorage(memBytes4);
    testBytes = hex"f00d000000000000000000000000000000000000000000000000000000feedf00dfeed";
    AssertBytes.equalStorage(storageBytes31, testBytes, "storageBytes31 + memBytes4 concatenation failed.");

    storageBytes32.concatStorage(memBytes4);
    testBytes = hex"f00d000000000000000000000000000000000000000000000000000000feedf00dfeed";
    AssertBytes.equalStorage(storageBytes32, testBytes, "storageBytes32 + memBytes4 concatenation failed.");

    ...


    storageBytes70.concatStorage(memBytes4);
    testBytes = hex"f00d000000000000000000000000000000000000000000000000000000feedf00dfeed";
    AssertBytes.equalStorage(storageBytes70, testBytes, "storageBytes70 + memBytes4 concatenation failed.");

These tests pass, which seems problematic.

This was a very serious flaw, failing test cases were simply not firing. Thank you for taking the time Niran!

This was apparently due to the mechanism that Truffle uses to start the Solidity-bound unit testing module. Unit testing only starts by calling a method of Truffle's Assert library and not by only importing it like I was doing.