String (int(0)) produces "-0"


#1

How’d this get past unit tests!!! LOL

Just fix the conditional:

    static char* numberToString (char* t, const int n) noexcept
    {
        if (n >= 0)

#2

Yes, whoops! It was only in the repo for a few minutes before I fixed it - I guess you pulled at an unfortunate moment!


#3

Did you add the unit tests for it? I added my own:

expectEquals (String (int (0)), "0");
expectEquals (String (short (0)), "0");
expectEquals (String (int64 (0)), "0");
expectEquals (String (unsigned int (0)), "0");
expectEquals (String (unsigned short (0)), "0");
expectEquals (String (uint64 (0)), "0");

expectEquals (String (int (-1)), "-1");
expectEquals (String (short (-1)), "-1");
expectEquals (String (int64 (-1)), "-1");

expectEquals (String (int (1)), "1");
expectEquals (String (short (1)), "1");
expectEquals (String (int64 (1)), "1");
expectEquals (String (unsigned int (1)), "1");
expectEquals (String (unsigned short (1)), "1");
expectEquals (String (uint64 (1)), "1");

Note that for this to compile you might want to upgrade expectEquals<> to take two template arguments. Not sure if that’s what you want though.

If not, you could always add expectEqualsRelaxed<> or whatever name you want, that has the two-template-argument version.