MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / test<1>

Method test<1>

Source/UnitTests/string_test.cpp:54–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52template <>
53template <>
54void strings::test<1>() {
55 ensure("ending test", endswith("my/cool/string.png", ".png") == true);
56 ensure("ending test", endswith("my/cool/string.png", ".pnk") == false);
57
58 char buffer[6];
59 ensure("strscpy exact match", strscpy(buffer, "false", 6) == 0);
60 ensure("strscpy source too long", strscpy(buffer, "false", 5) == SOURCE_TOO_LONG);
61 ensure("strscpy source is null", strscpy(buffer, NULL, 5) == SOURCE_IS_NULL);
62 ensure("strscpy zero length, null source", strscpy(buffer, NULL, 0) == DESTINATION_IS_ZERO_LENGTH);
63
64 ensure("saysTrue valid true", saysTrue("true") == 1);
65 ensure("saysTrue valid false", saysTrue("false") == 0);
66 ensure("saysTrue invalid", saysTrue("falseeeee") == -1);
67 ensure("saysTrue null", saysTrue(NULL) == -2);
68}
69
70template <>
71template <>

Callers

nothing calls this directly

Calls 4

ensureFunction · 0.85
endswithFunction · 0.85
strscpyFunction · 0.85
saysTrueFunction · 0.85

Tested by

no test coverage detected