From f24d303df6cb125ca19b953bb364955cc6e8c246 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 9 Nov 2018 17:07:13 +0100 Subject: Fixed consistency between the different tests mmult, prng and sort --- test/mppa/lib/.gitignore | 2 -- test/mppa/lib/Makefile | 30 ------------------------------ test/mppa/lib/prng.c | 39 --------------------------------------- test/mppa/lib/prng.h | 10 ---------- test/mppa/lib/types.h | 7 ------- 5 files changed, 88 deletions(-) delete mode 100644 test/mppa/lib/.gitignore delete mode 100644 test/mppa/lib/Makefile delete mode 100644 test/mppa/lib/prng.c delete mode 100644 test/mppa/lib/prng.h delete mode 100644 test/mppa/lib/types.h (limited to 'test/mppa/lib') diff --git a/test/mppa/lib/.gitignore b/test/mppa/lib/.gitignore deleted file mode 100644 index 1879eaee..00000000 --- a/test/mppa/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -prng-test-k1c -prng-test-x86 diff --git a/test/mppa/lib/Makefile b/test/mppa/lib/Makefile deleted file mode 100644 index 74e7ca8b..00000000 --- a/test/mppa/lib/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -prng-test-x86: prng.c - gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ - -prng-test-k1c: prng.c - k1-mbr-gcc -D__UNIT_TEST_PRNG__ -O2 -std=c99 $< -o $@ - -.PHONY: -test: test-x86 test-k1c - -.PHONY: -test-x86: prng-test-x86 - @if ! ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ - else\ - echo "x86: Test Succeeded";\ - fi - -.PHONY: -test-k1c: prng-test-k1c - @if ! k1-cluster -- ./$<; then\ - >&2 echo "ERROR: $< failed";\ - exit;\ - else\ - echo "k1c: Test Succeeded";\ - fi - -.PHONY: -clean: - rm -f prng-test-x86 prng-test-k1c diff --git a/test/mppa/lib/prng.c b/test/mppa/lib/prng.c deleted file mode 100644 index af3903d6..00000000 --- a/test/mppa/lib/prng.c +++ /dev/null @@ -1,39 +0,0 @@ -// https://en.wikipedia.org/wiki/Linear_congruential_generator -> MMIX Donald Knuth -// modulo 2^64 = no need to do it explicitly - -#include "types.h" - -#define MULTIPLIER 6364136223846793005LL -#define INCREMENT 1442695040888963407LL - -static uint64_t current; - -void srand(uint64_t seed){ - current = seed; -} - -uint64_t randlong(void){ - return (current = MULTIPLIER * current + INCREMENT); -} - -#ifdef __UNIT_TEST_PRNG__ -char bytewise_sum(uint64_t to_check){ - char sum = 0; - - for (int i = 0 ; i < 8 ; i++) - sum += (to_check & (uint64_t)(0xFFULL << i*8)) >> i*8; - - return sum; -} - -int main(void){ - srand(42); - - for (int i = 0 ; i < 1000 ; i++) - randlong(); - - uint64_t last = randlong(); - - return !((unsigned char)bytewise_sum(last) == 155); -} -#endif // __UNIT_TEST_PRNG__ diff --git a/test/mppa/lib/prng.h b/test/mppa/lib/prng.h deleted file mode 100644 index 6abdb45a..00000000 --- a/test/mppa/lib/prng.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __PRNG_H__ -#define __PRNG_H__ - -#include "types.h" - -void srand(uint64_t seed); - -uint64_t randlong(void); - -#endif // __PRNG_H__ diff --git a/test/mppa/lib/types.h b/test/mppa/lib/types.h deleted file mode 100644 index 584023e3..00000000 --- a/test/mppa/lib/types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ - -#define uint64_t unsigned long long -#define int64_t signed long long - -#endif // __TYPES_H__ -- cgit