aboutsummaryrefslogtreecommitdiff
path: root/core/tests/div.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-10-28 00:00:21 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-10-28 00:00:21 +0300
commitd96b8c7d12fc61ec609d6138627b9d6d18139a9a (patch)
tree82bc9a4c2b22de6c021097fb79a57b6d7756a127 /core/tests/div.c
downloadtri-d96b8c7d12fc61ec609d6138627b9d6d18139a9a.tar.gz
tri-d96b8c7d12fc61ec609d6138627b9d6d18139a9a.zip
move to monorepo
+ Will probably have to make some changes to dir layout to make things make more sense
Diffstat (limited to 'core/tests/div.c')
-rw-r--r--core/tests/div.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/tests/div.c b/core/tests/div.c
new file mode 100644
index 0000000..07e429d
--- /dev/null
+++ b/core/tests/div.c
@@ -0,0 +1,22 @@
+#include <tri.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+ assert(argc == 2);
+ char *s = argv[1];
+ tri_t a = tri_parse_default(s, strlen(s));
+ tri_t one = tri_from(1);
+
+ trival_t ba = tri_to(a);
+
+ for (size_t i = 0; i < 1000000000; ++i)
+ a = tri_div(a, one);
+
+ assert(ba == tri_to(a));
+
+ char r[32];
+ size_t l = tri_fmt_default(r, 32, a);
+ r[l] = '\0';
+ printf("%s\n", r);
+}