Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
test_utils.h File Reference
#include "munit.h"
#include <fp2.h>
#include <utilities.h>
#include <stdio.h>
Include dependency graph for test_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TEST_END    { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
#define SUITE_END    { NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }
#define PARAM_END    { NULL, NULL }
#define TEST_CASE(test_func)
#define TEST_CASE_SETUP(test_func, setup, teardown)
#define BENCHMARK(test_func, setup, teardown, params)
#define SUITE(suite_name, test_cases)
#define SUITE_IT(suite_name, test_cases, iterations)
#define SUITE_OF_SUITE(suite_name, nested_suite)
#define RANDOM_FP_ELEMENT(out)
#define RANDOM_SEED(out)
#define RANDOM_BIT_STRING(out)
#define RANDOM_TRIT_STRING(out)
#define MAX_MARKER_LEN   50

Macro Definition Documentation

◆ BENCHMARK

#define BENCHMARK ( test_func,
setup,
teardown,
params )
Value:
{ #test_func, test_func, setup, teardown, MUNIT_TEST_OPTION_SINGLE_ITERATION, params }
@ MUNIT_TEST_OPTION_SINGLE_ITERATION
Definition munit.h:442
Definition setup.py:1

Definition at line 25 of file test_utils.h.

25#define BENCHMARK(test_func, setup, teardown, params) \
26 { #test_func, test_func, setup, teardown, MUNIT_TEST_OPTION_SINGLE_ITERATION, params }

◆ MAX_MARKER_LEN

#define MAX_MARKER_LEN   50

Definition at line 78 of file test_utils.h.

◆ PARAM_END

#define PARAM_END    { NULL, NULL }

Definition at line 15 of file test_utils.h.

15#define PARAM_END \
16 { NULL, NULL }

◆ RANDOM_BIT_STRING

#define RANDOM_BIT_STRING ( out)
Value:
{ \
munit_rand_memory(BIT_LENGTH_PATH / 8, (munit_uint8_t *) (out)); \
}
#define munit_uint8_t
Definition munit.h:51
#define BIT_LENGTH_PATH
Definition p254.h:14

Definition at line 58 of file test_utils.h.

58#define RANDOM_BIT_STRING(out) \
59{ \
60 munit_rand_memory(BIT_LENGTH_PATH / 8, (munit_uint8_t *) (out)); \
61}

◆ RANDOM_FP_ELEMENT

#define RANDOM_FP_ELEMENT ( out)
Value:
{ \
munit_rand_memory(FIELD_BYTES, (munit_uint8_t *) (out)); \
while (!multiprecision_is_smaller((out), FIELD_CHARACTERISTIC, FIELD_64BITS_WORDS)) { \
munit_rand_memory(FIELD_BYTES, (munit_uint8_t *) (out)); \
} \
}
#define FIELD_BYTES
Definition p254.h:8
#define FIELD_64BITS_WORDS
Definition p254.h:9
#define MASK_FIELD_ELEMENT
Definition p254.h:11
uint8_t multiprecision_is_smaller(const uint64_t *input_a, const uint64_t *input_b, uint64_t input_length)
Definition utilities.c:111

Definition at line 38 of file test_utils.h.

38#define RANDOM_FP_ELEMENT(out) \
39{ \
40 munit_rand_memory(FIELD_BYTES, (munit_uint8_t *) (out)); \
41 (out)[FIELD_64BITS_WORDS - 1] &= MASK_FIELD_ELEMENT; \
42 while (!multiprecision_is_smaller((out), FIELD_CHARACTERISTIC, FIELD_64BITS_WORDS)) { \
43 munit_rand_memory(FIELD_BYTES, (munit_uint8_t *) (out)); \
44 (out)[FIELD_64BITS_WORDS - 1] &= MASK_FIELD_ELEMENT; \
45 } \
46}

◆ RANDOM_SEED

#define RANDOM_SEED ( out)
Value:
{ \
munit_rand_memory(SECURITY_BITS / 8, (munit_uint8_t *) (out)); \
}
#define SECURITY_BITS
Definition p254.h:12

Definition at line 48 of file test_utils.h.

48#define RANDOM_SEED(out) \
49{ \
50 munit_rand_memory(SECURITY_BITS / 8, (munit_uint8_t *) (out)); \
51}

◆ RANDOM_TRIT_STRING

#define RANDOM_TRIT_STRING ( out)
Value:
{ \
uint8_t bound = 0xF3; \
for(int i = 0; i < (TRITLENGTH_PATH / 5); i++) { \
uint8_t trit_str; \
munit_rand_memory(1, (munit_uint8_t *) (&trit_str)); \
while (issmaller(bound, trit_str)) { \
munit_rand_memory(1, (munit_uint8_t *) (&trit_str)); \
} \
out[i] = trit_str; \
} \
}
#define TRITLENGTH_PATH
Definition p254.h:15
for i

Definition at line 64 of file test_utils.h.

64#define RANDOM_TRIT_STRING(out) \
65{ \
66 uint8_t bound = 0xF3; \
67 for(int i = 0; i < (TRITLENGTH_PATH / 5); i++) { \
68 uint8_t trit_str; \
69 munit_rand_memory(1, (munit_uint8_t *) (&trit_str)); \
70 while (issmaller(bound, trit_str)) { \
71 munit_rand_memory(1, (munit_uint8_t *) (&trit_str)); \
72 } \
73 out[i] = trit_str; \
74 } \
75}

◆ SUITE

#define SUITE ( suite_name,
test_cases )
Value:
{ suite_name, test_cases, NULL, 0, MUNIT_SUITE_OPTION_NONE }
@ MUNIT_SUITE_OPTION_NONE
Definition munit.h:462

Definition at line 28 of file test_utils.h.

28#define SUITE(suite_name, test_cases) \
29 { suite_name, test_cases, NULL, 0, MUNIT_SUITE_OPTION_NONE }

◆ SUITE_END

#define SUITE_END    { NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }

Definition at line 13 of file test_utils.h.

13#define SUITE_END \
14 { NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }

◆ SUITE_IT

#define SUITE_IT ( suite_name,
test_cases,
iterations )
Value:
{ suite_name, test_cases, NULL, iterations, MUNIT_SUITE_OPTION_NONE }

Definition at line 31 of file test_utils.h.

31#define SUITE_IT(suite_name, test_cases, iterations) \
32 { suite_name, test_cases, NULL, iterations, MUNIT_SUITE_OPTION_NONE }

◆ SUITE_OF_SUITE

#define SUITE_OF_SUITE ( suite_name,
nested_suite )
Value:
{ suite_name, NULL, nested_suite, 0, MUNIT_SUITE_OPTION_NONE }

Definition at line 34 of file test_utils.h.

34#define SUITE_OF_SUITE(suite_name, nested_suite) \
35 { suite_name, NULL, nested_suite, 0, MUNIT_SUITE_OPTION_NONE }

◆ TEST_CASE

#define TEST_CASE ( test_func)
Value:
{ #test_func, test_func, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
@ MUNIT_TEST_OPTION_NONE
Definition munit.h:441

Definition at line 19 of file test_utils.h.

19#define TEST_CASE(test_func) \
20 { #test_func, test_func, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }

◆ TEST_CASE_SETUP

#define TEST_CASE_SETUP ( test_func,
setup,
teardown )
Value:
{ #test_func, test_func, setup, teardown, MUNIT_TEST_OPTION_NONE, NULL }

Definition at line 22 of file test_utils.h.

22#define TEST_CASE_SETUP(test_func, setup, teardown) \
23 { #test_func, test_func, setup, teardown, MUNIT_TEST_OPTION_NONE, NULL }

◆ TEST_END

#define TEST_END    { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }

Definition at line 11 of file test_utils.h.

11#define TEST_END \
12 { NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }