File: test_I_plus.cc

package info (click to toggle)
cln 1.1.13-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,040 kB
  • ctags: 17,214
  • sloc: cpp: 79,175; sh: 7,794; ansic: 4,194; makefile: 631; lisp: 115
file content (26 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (13)
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
#include "test_I.h"

int test_I_plus (int iterations)
{
	int error = 0;
	int i;
	// Check commutativity.
	for (i = iterations; i > 0; i--) {
		cl_I a = testrandom_I();
		cl_I b = testrandom_I();
		ASSERT2(a+b == b+a, a,b);
	}
	// Check associativity.
	for (i = iterations; i > 0; i--) {
		cl_I a = testrandom_I();
		cl_I b = testrandom_I();
		cl_I c = testrandom_I();
		ASSERT3((a+b)+c == a+(b+c), a,b,c);
	}
	// Check special case 0.
	for (i = iterations; i > 0; i--) {
		cl_I a = testrandom_I();
		ASSERT1(a+0 == a, a);
	}
	return error;
}