add TC prefix to types, too

This commit is contained in:
Dustin J. Mitchell
2022-01-23 19:57:42 +00:00
parent 46e08bc040
commit 821118106a
6 changed files with 69 additions and 77 deletions

View File

@@ -2,14 +2,14 @@
#include "doctest.h"
#include "taskchampion.h"
TEST_CASE("creating an in-memory Replica does not crash") {
Replica *rep = tc_replica_new(NULL);
TEST_CASE("creating an in-memory TCReplica does not crash") {
TCReplica *rep = tc_replica_new(NULL);
CHECK(tc_replica_error(rep) == NULL);
tc_replica_free(rep);
}
TEST_CASE("undo on an empty in-memory Replica does nothing") {
Replica *rep = tc_replica_new(NULL);
TEST_CASE("undo on an empty in-memory TCReplica does nothing") {
TCReplica *rep = tc_replica_new(NULL);
CHECK(tc_replica_error(rep) == NULL);
int rv = tc_replica_undo(rep);
CHECK(rv == 0);

View File

@@ -3,12 +3,12 @@
#include "taskchampion.h"
TEST_CASE("creating UUIDs does not crash") {
Uuid u1 = tc_uuid_new_v4();
Uuid u2 = tc_uuid_nil();
TCUuid u1 = tc_uuid_new_v4();
TCUuid u2 = tc_uuid_nil();
}
TEST_CASE("converting UUIDs to string works") {
Uuid u2 = tc_uuid_nil();
TCUuid u2 = tc_uuid_nil();
REQUIRE(TC_UUID_STRING_BYTES == 36);
char u2str[TC_UUID_STRING_BYTES];
@@ -17,22 +17,22 @@ TEST_CASE("converting UUIDs to string works") {
}
TEST_CASE("converting UUIDs from string works") {
Uuid u;
TCUuid u;
char ustr[TC_UUID_STRING_BYTES] = "fdc314b7-f938-4845-b8d1-95716e4eb762";
CHECK(tc_uuid_from_str(ustr, &u));
CHECK(u._0[0] == 0xfd);
// .. if these two are correct, probably it worked :)
CHECK(u._0[15] == 0x62);
CHECK(u.bytes[0] == 0xfd);
// .. if these two bytes are correct, then it probably worked :)
CHECK(u.bytes[15] == 0x62);
}
TEST_CASE("converting invalid UUIDs from string fails as expected") {
Uuid u;
TCUuid u;
char ustr[TC_UUID_STRING_BYTES] = "not-a-valid-uuid";
CHECK(!tc_uuid_from_str(ustr, &u));
}
TEST_CASE("converting invalid UTF-8 UUIDs from string fails as expected") {
Uuid u;
TCUuid u;
char ustr[TC_UUID_STRING_BYTES] = "\xf0\x28\x8c\xbc";
CHECK(!tc_uuid_from_str(ustr, &u));
}