aboutsummaryrefslogtreecommitdiff
path: root/tests/test_str.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2025-06-30 11:53:53 -0400
committerGitHub <noreply@github.com>2025-06-30 11:53:53 -0400
commit9c85b01ce13fae21f45719c18483cb65f2874a67 (patch)
tree0a843126ae567cae9494aa19df6d2f353ee55b6a /tests/test_str.c
parent1c78b0077bce9f0ebf7ab472ba4fa8c2c0169ff8 (diff)
parent25e9ffa5dfe2e17498b58e7e73d1569abea314bb (diff)
downloadstasis-9c85b01ce13fae21f45719c18483cb65f2874a67.tar.gz
Merge pull request #112 from jhunkeler/bug-fixes-again
to_short_version: drop any values beyond "major.minor"
Diffstat (limited to 'tests/test_str.c')
-rw-r--r--tests/test_str.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_str.c b/tests/test_str.c
index ad0c07a..a98a34d 100644
--- a/tests/test_str.c
+++ b/tests/test_str.c
@@ -6,16 +6,17 @@ void test_to_short_version() {
const char *expected;
};
- struct testcase tc[] = {
- {.data = "1.2.3", .expected = "123"},
+ const struct testcase tc[] = {
+ {.data = "1.2.3", .expected = "12"},
{.data = "py3.12", .expected = "py312"},
- {.data = "generic-1.2.3", .expected = "generic-123"},
+ {.data = "generic-1.2.3", .expected = "generic-12"},
{.data = "nothing to do", .expected = "nothing to do"},
};
for (size_t i = 0; i < sizeof(tc) / sizeof(*tc); i++) {
char *result = to_short_version(tc[i].data);
STASIS_ASSERT_FATAL(result != NULL, "should not be NULL");
+ //printf("%s[%zu], result: %s, expected: %s\n", __FUNCTION__, i, result, tc[i].expected);
STASIS_ASSERT(strcmp(result, tc[i].expected) == 0, "unexpected result");
guard_free(result);
}