summaryrefslogtreecommitdiff
path: root/src/user/app/tests
diff options
context:
space:
mode:
authordzwdz2022-08-23 19:15:59 +0200
committerdzwdz2022-08-23 19:15:59 +0200
commit38cf66edaacc4e58b561bea8a77abfd3facf59fe (patch)
tree2e9ff33e195078fdcd454607082064e949b29bd4 /src/user/app/tests
parent03c5dd9462492e291c6a49b88e1cd9ab34d86b6f (diff)
shared/ring: rename ring_size to ring_used, add ring_avail
Diffstat (limited to 'src/user/app/tests')
-rw-r--r--src/user/app/tests/shared/ringbuf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/user/app/tests/shared/ringbuf.c b/src/user/app/tests/shared/ringbuf.c
index 7330bbe..d4e8dc9 100644
--- a/src/user/app/tests/shared/ringbuf.c
+++ b/src/user/app/tests/shared/ringbuf.c
@@ -11,34 +11,36 @@ static void test_ringbuf(void) {
/* aliasing */
for (size_t i = 0; i < 16; i++) {
- test(ring_size(&r) == 0);
+ test(ring_used(&r) == 0);
+ test(ring_avail(&r) == 16);
ring_put(&r, "11 bytes...", 11);
- test(ring_size(&r) == 11);
+ test(ring_used(&r) == 11);
+ test(ring_avail(&r) == 5);
memset(cmpbuf, 0, sizeof cmpbuf);
test(ring_get(&r, cmpbuf, 16) == 11);
test(memcmp(cmpbuf, "11 bytes...", 11) == 0);
}
- test(ring_size(&r) == 0);
+ test(ring_used(&r) == 0);
for (size_t i = 0; i < 7; i++)
ring_put1b(&r, num_written++);
- test(ring_size(&r) == 7);
+ test(ring_used(&r) == 7);
for (size_t i = 0; i < 3; i++) {
ring_get(&r, &c, 1);
test(num_read++ == c);
}
- test(ring_size(&r) == 4);
+ test(ring_used(&r) == 4);
for (size_t j = 0; j < 40; j++) {
for (size_t i = 0; i < 7; i++)
ring_put1b(&r, num_written++ & 0xff);
- test(ring_size(&r) == 11);
+ test(ring_used(&r) == 11);
for (size_t i = 0; i < 7; i++) {
ring_get(&r, &c, 1);
test((num_read++ & 0xff) == c);
}
- test(ring_size(&r) == 4);
+ test(ring_used(&r) == 4);
}
}