Esempio n. 1
0
int main(int argc, const char **argv)
{
	test_create();
	test_to_long_long();
	test_compare();
	test_add();
	test_subtract();
	test_increment();
	test_decrement();
	
	test_performance();

	printf("\nAll tests passed!\n");
	return EXIT_SUCCESS;
};
Esempio n. 2
0
void test_integer()
{
	// Implement sub with only add
	test_subtract();

	// Implement mul with only add
	test_multiply();

	// Implement div with only add
	test_divide();

	// Reverse digits of an integer
	test_reverseInteger();

	// Determine whether an integer is a palindrome. Do this without extra space
	test_isPalindrome<IsPalindromeIterative>();
	test_isPalindrome<IsPalindromeRecursion>();
}
Esempio n. 3
0
rtems_task Init(
  rtems_task_argument argument
)
{
  timespec1=&ts1;
  timespec2=&ts2;

  puts( "\n\n*** TEST sptimespec01 ***" );

  test_add();
  test_divide();
  test_divide_by_integer();
  test_compare();
  test_validity();
  test_subtract();
  test_convert();

  puts( "\n*** END OF TEST sptimespec01 ***" );

  rtems_test_exit(0);
}
Esempio n. 4
0
void test_all_subtract() {
    test_subtract(nan, three, nan, "nan - 3");
    test_subtract(nannan, nannan, nan, "nannan - nannan");
    test_subtract(nannan, one, nan, "nannan - 1");
    test_subtract(zero, nannan, nan, "0 - nannan");
    test_subtract(zero, zip, zero, "zero - zip");
    test_subtract(zero, negative_pi, pi, "0 - -pi");
    test_subtract(zero, pi, negative_pi, "0 - pi");
    test_subtract(zero, negative_maxint, maxint_plus, "-maxint");
    test_subtract(zero, negative_maxnum, nan, "0 - -maxnum");
    test_subtract(zip, zero, zero, "zip - zero");
    test_subtract(zip, zip, zero, "zip - zip");
    test_subtract(epsilon, epsilon, zero, "epsilon - epsilon");
    test_subtract(one, negative_maxint, maxint_plus, "1  - -maxint");
    test_subtract(one, epsilon, almost_one, "1 - epsilon");
    test_subtract(one, almost_one, epsilon, "1 - almost_one");
    test_subtract(negative_one, negative_maxint, maxint, "-1  - -maxint");
    test_subtract(three, nan, nan, "3 - nan");
    test_subtract(three, dec64_new(30000000000000000, -16), zero, "equal but with different exponents");
    test_subtract(three, four, dec64_new(-1, 0), "3 - 4");
    test_subtract(negative_pi, negative_pi, zero, "-pi - 0");
    test_subtract(negative_pi, zero, negative_pi, "-pi - 0");
    test_subtract(four, dec64_new(4000000000000000, -15), zero, "equal but with different exponents");
    test_subtract(ten, six, four, "10 - 6");
    test_subtract(maxint, negative_maxint, dec64_new(7205759403792794, 1), "-maxint");
    test_subtract(maxint, maxint_plus, dec64_new(-3, 0), "maxint - (maxint + 1)");
    test_subtract(negative_maxint, negative_maxint, zero, "-maxint - -maxint");
    test_subtract(maxnum, maxint, maxnum, "maxnum - maxint");
    test_subtract(maxnum, negative_maxint, maxnum, "maxnum - -maxint");
    test_subtract(maxnum, maxnum, zero, "maxnum - maxnum");
}