Пример #1
0
int main() {

	printf("start testing\n"); 

	int from = -100, to = 100; 
	for (int i = from; i <= to; i++) {
		assert(0 - i == negate(i)); 
		assert(((i % 2) == 0) == is_even(i)); 
		assert(i * 2 == multiply_by_two(i)); 
		if (is_even(i)) {
			assert(i / 2 == divide_by_two(i)); 
		}
	}

	for (int i = from;i <= to; i++) {
		for (int j = from; j <= to; j++) {
			assert(i + j == add_i(i, j)); 
			assert(i - j == subtract(i, j)); 
			assert(i * j == multiply(i, j)); 
		}
	}

	printf("end testing\n"); 
	return 0; 
}
Пример #2
0
void test_multiply(void)
{
    int num = 2;
    int result = multiply_by_two(num);
    TEST_CHECK_((result == num*2),"ok");
}