aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/_brk-test.h14
-rw-r--r--test/_case-test.h4
-rw-r--r--test/_norm-test.h16
-rw-r--r--test/wbrk-human-test.c12
4 files changed, 23 insertions, 23 deletions
diff --git a/test/_brk-test.h b/test/_brk-test.h
index 21a6a2b..00b84ff 100644
--- a/test/_brk-test.h
+++ b/test/_brk-test.h
@@ -18,7 +18,7 @@
#define ITERFUNC CONCAT(CONCAT(ucs, BRKTYPE), next)
#define CNTFUNC CONCAT(CONCAT(ucs, BRKTYPE), cnt)
-static bool test(struct u8view, int);
+static bool test(u8view_t, int);
int
main(int, char **argv)
@@ -40,7 +40,7 @@ main(int, char **argv)
if (line[nr - 1] == '\n')
line[--nr] = '\0';
- if (!test((struct u8view){line, (size_t)nr}, id))
+ if (!test((u8view_t){line, (size_t)nr}, id))
rv = EXIT_FAILURE;
}
if (ferror(fp))
@@ -52,7 +52,7 @@ main(int, char **argv)
}
bool
-test(struct u8view sv, int id)
+test(u8view_t sv, int id)
{
bool rv = true;
size_t total = 0;
@@ -67,7 +67,7 @@ test(struct u8view sv, int id)
};
rune op;
- struct u8view sv_cpy = sv;
+ u8view_t sv_cpy = sv;
while ((op = ucscut(nullptr, &sv_cpy, U"×÷", 2)) != MBEND) {
rune ch;
sscanf(sv_cpy.p, "%" SCNxRUNE, &ch);
@@ -88,7 +88,7 @@ test(struct u8view sv, int id)
off += g->len;
}
- struct u8view buf = {p, total};
+ u8view_t buf = {p, total};
/* Assert the item count is correct */
size_t items_got = CNTFUNC(buf);
@@ -100,10 +100,10 @@ test(struct u8view sv, int id)
}
/* Assert the individual items are correct */
- struct u8view it1, buf_cpy = buf;
+ u8view_t it1, buf_cpy = buf;
for (size_t i = 0; ITERFUNC(&it1, &buf_cpy); i++) {
item it2 = items.buf[i];
- if (!ucseq(it1, ((struct u8view){it2.buf, it2.len}))) {
+ if (!ucseq(it1, ((u8view_t){it2.buf, it2.len}))) {
warn("case %d: expected %s ‘%.*s’ but got ‘%.*s’", id,
STR(BRKTYPE_LONG), (int)it2.len, it2.buf, SV_PRI_ARGS(it1));
rv = false;
diff --git a/test/_case-test.h b/test/_case-test.h
index 24a18f1..299f079 100644
--- a/test/_case-test.h
+++ b/test/_case-test.h
@@ -52,8 +52,8 @@ main(int, char **argv)
bool
test(const char8_t *line, int id)
{
- struct u8view mapped, sv = {line, strlen(line)};
- struct u8view before, after, flags;
+ u8view_t mapped, sv = {line, strlen(line)};
+ u8view_t before, after, flags;
ucscut(&before, &sv, U";", 1);
ucscut(&after, &sv, U";", 1);
ucscut(&flags, &sv, U";", 1);
diff --git a/test/_norm-test.h b/test/_norm-test.h
index 43f8731..744bc93 100644
--- a/test/_norm-test.h
+++ b/test/_norm-test.h
@@ -16,7 +16,7 @@
#define TESTFILE "norm.in"
-static bool test(struct u8view, int);
+static bool test(u8view_t, int);
int
main(int, char **argv)
@@ -38,7 +38,7 @@ main(int, char **argv)
if (line[nr - 1] == '\n')
line[--nr] = '\0';
- if (!test((struct u8view){line, (size_t)nr}, id))
+ if (!test((u8view_t){line, (size_t)nr}, id))
rv = EXIT_FAILURE;
}
if (ferror(fp))
@@ -50,18 +50,18 @@ main(int, char **argv)
}
bool
-test(struct u8view sv, int id)
+test(u8view_t sv, int id)
{
bool rv = true;
arena a = mkarena(0);
struct arena_ctx ctx = {.a = &a};
- dynarr(struct u8view) columns = {
+ dynarr(u8view_t) columns = {
.alloc = alloc_arena,
.ctx = &ctx,
};
- struct u8view column;
+ u8view_t column;
while (ucscut(&column, &sv, U";", 1) != MBEND) {
dynarr(char8_t) s = {
.alloc = alloc_arena,
@@ -69,7 +69,7 @@ test(struct u8view sv, int id)
};
rune _;
- struct u8view cp;
+ u8view_t cp;
do {
rune ch;
_ = ucscut(&cp, &column, U" ", 1);
@@ -79,7 +79,7 @@ test(struct u8view sv, int id)
DAEXTEND(&s, buf, w);
} while (_ != MBEND);
- DAPUSH(&columns, ((struct u8view){s.buf, s.len}));
+ DAPUSH(&columns, ((u8view_t){s.buf, s.len}));
}
for (size_t i = 0; i < 5; i++) {
@@ -96,7 +96,7 @@ test(struct u8view sv, int id)
else
err("invalid NORMTYPE ‘%s’", nt);
- struct u8view normd = {};
+ u8view_t normd = {};
normd.p =
ucsnorm(&normd.len, columns.buf[i], alloc_arena, &ctx, NORMTYPE);
if (!ucseq(columns.buf[base], normd)) {
diff --git a/test/wbrk-human-test.c b/test/wbrk-human-test.c
index 24a3513..955cf4f 100644
--- a/test/wbrk-human-test.c
+++ b/test/wbrk-human-test.c
@@ -10,7 +10,7 @@
#define TESTFILE "wbrk-human.in"
-static bool test(struct u8view, int);
+static bool test(u8view_t, int);
int
main(int, char **argv)
@@ -32,7 +32,7 @@ main(int, char **argv)
if (line[nr - 1] == '\n')
line[--nr] = '\0';
- if (!test((struct u8view){line, nr}, id))
+ if (!test((u8view_t){line, nr}, id))
rv = EXIT_FAILURE;
}
if (ferror(fp))
@@ -44,13 +44,13 @@ main(int, char **argv)
}
bool
-test(struct u8view sv, int id)
+test(u8view_t sv, int id)
{
- struct u8view src;
+ u8view_t src;
ucscut(&src, &sv, U";", 1);
- struct u8view w;
- dynarr(struct u8view) ws = {.alloc = alloc_heap};
+ u8view_t w;
+ dynarr(u8view_t) ws = {.alloc = alloc_heap};
while (ucscut(&w, &sv, U"|", 1) != MBEND)
DAPUSH(&ws, w);