24 GroupT base, el, result;
26 base = GroupT::zero();
29 result = base.mixed_add(el);
30 assert(result == base + el);
32 base = GroupT::zero();
33 el = GroupT::random_element();
35 result = base.mixed_add(el);
36 assert(result == base + el);
38 base = GroupT::random_element();
41 result = base.mixed_add(el);
42 assert(result == base + el);
44 base = GroupT::random_element();
45 el = GroupT::random_element();
47 result = base.mixed_add(el);
48 assert(result == base + el);
50 base = GroupT::random_element();
53 result = base.mixed_add(el);
54 assert(result == base.dbl());
64 GroupT zero = GroupT::zero();
66 GroupT
one = GroupT::one();
68 GroupT two =
bigint<1>(2l) * GroupT::one();
70 GroupT five =
bigint<1>(5l) * GroupT::one();
72 GroupT three =
bigint<1>(3l) * GroupT::one();
73 GroupT four =
bigint<1>(4l) * GroupT::one();
75 assert(two+five == three+four);
77 GroupT
a = GroupT::random_element();
78 GroupT b = GroupT::random_element();
87 assert(
a.dbl() ==
a +
a);
88 assert(b.dbl() == b + b);
89 assert(
one.add(two) == three);
90 assert(two.add(
one) == three);
91 assert(
a + b == b +
a);
92 assert(
a -
a == zero);
93 assert(
a - b ==
a + (-b));
94 assert(
a - b == (-b) +
a);
97 assert(zero + (-
a) == -
a);
98 assert(zero -
a == -
a);
99 assert(
a - zero ==
a);
100 assert(
a + zero ==
a);
101 assert(zero +
a ==
a);
103 assert((
a + b).dbl() == (
a + b) + (b +
a));
106 assert((rand1 *
a) + (rand2 *
a) == (randsum *
a));
108 assert(GroupT::order() *
a == zero);
109 assert(GroupT::order() *
one == zero);
110 assert((GroupT::order() *
a) -
a != zero);
111 assert((GroupT::order() *
one) -
one != zero);