From d1d5e149713c42a734778b3021a22c1a96ea011d Mon Sep 17 00:00:00 2001 From: Quinn Date: Sun, 13 Jul 2025 12:21:37 +0200 Subject: [PATCH] add a test which ensures that bit shift right is an arithmetic shift, not logical shift. --- test/dat.h | 2 ++ test/t_arith.h | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 test/t_arith.h diff --git a/test/dat.h b/test/dat.h index 8ca7bab..9ec93cc 100644 --- a/test/dat.h +++ b/test/dat.h @@ -2,10 +2,12 @@ #include "../src/util/conf.h" #include "../src/util/types.h" +#include "t_arith.h" #include "t_conf.h" #include "test.h" testdat tests[] = { + {"ensure SAR", test_sar, NULL }, {"k=v", test_procbuf, &(struct test_procbuf){"key=val", "key", "val", 0} }, {"sometxt", test_procbuf, &(struct test_procbuf){"sometxt", "sometxt", "", CONF_ESYNTAX} }, {"comment", test_procbuf, &(struct test_procbuf){"# comment", "", "", CONF_ENODAT} }, diff --git a/test/t_arith.h b/test/t_arith.h new file mode 100644 index 0000000..99b24f4 --- /dev/null +++ b/test/t_arith.h @@ -0,0 +1,8 @@ +#pragma once + +#include "test.h" + +int test_sar(void *dat) { + (void)dat; + return assert_true(-3 >> 5 == -1); +}