aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_post_concat_adjust_.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-09-25 23:42:55 +0200
committerMattias Andrée <m@maandree.se>2026-09-25 23:42:55 +0200
commit4e81cb177ab77904e7a21ce70b9a5506bf09ad6e (patch)
tree05634bdcd5b52c25bbeb986748d6b2c5acb728fb /librecrypt_post_concat_adjust_.c
parentm (diff)
downloadlibrecrypt-4e81cb177ab77904e7a21ce70b9a5506bf09ad6e.tar.gz
librecrypt-4e81cb177ab77904e7a21ce70b9a5506bf09ad6e.tar.bz2
librecrypt-4e81cb177ab77904e7a21ce70b9a5506bf09ad6e.tar.xz
Add tests
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--librecrypt_post_concat_adjust_.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/librecrypt_post_concat_adjust_.c b/librecrypt_post_concat_adjust_.c
index 04715fd..458f4cb 100644
--- a/librecrypt_post_concat_adjust_.c
+++ b/librecrypt_post_concat_adjust_.c
@@ -12,10 +12,23 @@ extern inline int librecrypt_post_concat_adjust_(struct concat_state *state, siz
int
main(void)
{
+ char buf[4];
+ struct concat_state state = {buf, sizeof(buf), 0u};
+
SET_UP_ALARM();
INIT_RESOURCE_TEST();
- /* TODO test */
+ assert(librecrypt_post_concat_adjust_(&state, 2u) == 0);
+ assert(state.buf == &buf[2u]);
+ assert(state.size == 2u);
+ assert(state.len == 2u);
+ assert(librecrypt_post_concat_adjust_(&state, 5u) == 0);
+ assert(state.buf == &buf[3u]);
+ assert(state.size == 1u);
+ assert(state.len == 7u);
+
+ state = (struct concat_state){buf, sizeof(buf), SIZE_MAX};
+ assert(librecrypt_post_concat_adjust_(&state, 1u) == -1);
STOP_RESOURCE_TEST();
return 0;