aboutsummaryrefslogtreecommitdiff
path: root/tests/test-mul64.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2021-03-10 07:33:14 +0100
committerThomas Huth <thuth@redhat.com>2021-03-12 15:46:30 +0100
commitda668aa15b99150a8595c491aee00d5d2426aaf9 (patch)
tree0463b0a303e807bdab46460f6c702be611bd7179 /tests/test-mul64.c
parent363fc963054d8e82cfd55fa9b9aa130692a8dbd7 (diff)
tests: Move unit tests into a separate directory
The main tests directory still looks very crowded, and it's not clear which files are part of a unit tests and which belong to a different test subsystem. Let's clean up the mess and move the unit tests to a separate directory. Message-Id: <20210310063314.1049838-1-thuth@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/test-mul64.c')
-rw-r--r--tests/test-mul64.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/tests/test-mul64.c b/tests/test-mul64.c
deleted file mode 100644
index 9be775d084..0000000000
--- a/tests/test-mul64.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Test 64x64 -> 128 multiply subroutines
- *
- * This work is licensed under the terms of the GNU LGPL, version 2 or later.
- * See the COPYING.LIB file in the top-level directory.
- *
- */
-
-#include "qemu/osdep.h"
-#include "qemu/host-utils.h"
-
-
-typedef struct {
- uint64_t a, b;
- uint64_t rh, rl;
-} Test;
-
-static const Test test_u_data[] = {
- { 1, 1, 0, 1 },
- { 10000, 10000, 0, 100000000 },
- { 0xffffffffffffffffULL, 2, 1, 0xfffffffffffffffeULL },
- { 0xffffffffffffffffULL, 0xffffffffffffffffULL,
- 0xfffffffffffffffeULL, 0x0000000000000001ULL },
- { 0x1122334455667788ull, 0x8877665544332211ull,
- 0x092228fb777ae38full, 0x0a3e963337c60008ull },
-};
-
-static const Test test_s_data[] = {
- { 1, 1, 0, 1 },
- { 1, -1, -1, -1 },
- { -10, -10, 0, 100 },
- { 10000, 10000, 0, 100000000 },
- { -1, 2, -1, -2 },
- { 0x1122334455667788ULL, 0x1122334455667788ULL,
- 0x01258f60bbc2975cULL, 0x1eace4a3c82fb840ULL },
-};
-
-static void test_u(void)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(test_u_data); ++i) {
- uint64_t rl, rh;
- mulu64(&rl, &rh, test_u_data[i].a, test_u_data[i].b);
- g_assert_cmpuint(rl, ==, test_u_data[i].rl);
- g_assert_cmpuint(rh, ==, test_u_data[i].rh);
- }
-}
-
-static void test_s(void)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(test_s_data); ++i) {
- uint64_t rl, rh;
- muls64(&rl, &rh, test_s_data[i].a, test_s_data[i].b);
- g_assert_cmpuint(rl, ==, test_s_data[i].rl);
- g_assert_cmpint(rh, ==, test_s_data[i].rh);
- }
-}
-
-int main(int argc, char **argv)
-{
- g_test_init(&argc, &argv, NULL);
- g_test_add_func("/host-utils/mulu64", test_u);
- g_test_add_func("/host-utils/muls64", test_s);
- return g_test_run();
-}