aboutsummaryrefslogtreecommitdiff
path: root/test/src/gen/test_curve.c
blob: 636a136db7889871698d6ea7a88bf0b25ce1d4bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * ecgen, tool for generating Elliptic curve domain parameters
 * Copyright (C) 2017-2018 J08nY
 */
#include <criterion/criterion.h>
#include "gen/curve.h"
#include "obj/curve.h"
#include "test/default.h"

TestSuite(curve, .init = default_setup, .fini = default_teardown);

Test(curve, test_curve_new) {
	curve_t *curve = curve_new();
	cr_assert_not_null(curve, );
	curve_free(&curve);
	cr_assert_null(curve, );
}

Test(curve, test_curve_copy) {
	curve_t *curve = curve_new();
	curve_t *other = curve_new_copy(curve);
	cr_assert_not_null(other, );
	curve_copy(curve, other);
	cr_assert_not_null(other, );
	curve_free(&curve);
	curve_free(&other);
}

Test(curve, test_curve_clone) {
	curve_t *curve = curve_new();
	curve_t *other = curve_new_clone(curve);
	cr_assert_not_null(other, );
	curve_clone(curve, other);
	cr_assert_not_null(other, );
	curve_free(&curve);
	curve_free(&other);
}