CTEST(total,test2) { int a = 1, b = 4, c = 4; Square z = func1(a,b,c); ASSERT_DBL_NEAR(1, z.state); ASSERT_DBL_NEAR(-2, z.res1); }
CTEST(total,test1) { const int a = 1, b = -70, c = 600; Square z = func1(a, b, c); ASSERT_DBL_NEAR(60, z.res1); ASSERT_DBL_NEAR(10, z.res2); }
CTEST(TwoSolutions, test2) { double *arr = NULL; int amount = solve(1, 0, -1, &arr); ASSERT_EQUAL(2, amount); ASSERT_DBL_NEAR(-1.00000, *arr); ASSERT_DBL_NEAR(1.00000, *(arr + 1)); free(arr); }
CTEST(TwoSolutions, test1) { double *arr = NULL; int amount = solve(1, 1, -6, &arr); ASSERT_EQUAL(2, amount); ASSERT_DBL_NEAR(-3.00000, *arr); ASSERT_DBL_NEAR(2.00000, *(arr + 1)); free(arr); }
CTEST(total, id_12) { // When kor res = koren(a,b,c); // Then const float x1 = 1; const float x2 = -1; ASSERT_DBL_NEAR(x1, res.x1); ASSERT_DBL_NEAR(x2, res.x2); }
CTEST(app_suite, odin_koren) { const double a = 1, b = -2, c = 1; double d, x1, x2; const int koren = uravn(a, b, c, &d, &x1, &x2), ex_koren = 1, ex_d = 0, ex_x1 = 1; ASSERT_EQUAL(ex_koren, koren); ASSERT_DBL_NEAR(ex_d, d); ASSERT_DBL_NEAR(ex_x1, x1); }
CTEST(app_suite, dva_kornya) { const double a = 2, b = -3, c = 1; double d, x1, x2; const int koren = uravn(a, b, c, &d, &x1, &x2), ex_koren = 2, ex_d = 1, ex_x1 = 1, ex_x2 = 0.5; ASSERT_EQUAL(ex_koren, koren); ASSERT_DBL_NEAR(ex_d, d); ASSERT_DBL_NEAR(ex_x1, x1); ASSERT_DBL_NEAR(ex_x2, x2); }
CTEST(test, uno_roots) { const float a = 1; const float b = 2; const float c = 1; const struct skr roots = diskr(a, b, c); const struct skr uno_roots = {-1}; ASSERT_DBL_NEAR(uno_roots.x1, roots.x1); ASSERT_DBL_NEAR(uno_roots.x2, roots.x2); }
CTEST(test, dos_roots) { const float a = 1; const float b = 5; const float c = 6; const struct skr roots = diskr(a, b, c); const struct skr dos_roots = {-2, -3}; ASSERT_DBL_NEAR(dos_roots.x1, roots.x1); ASSERT_DBL_NEAR(dos_roots.x2, roots.x2); }
CTEST(OneSolution, test2) { double *arr = NULL; int amount = solve(1, -2, 1, &arr); ASSERT_EQUAL(1, amount); ASSERT_DBL_NEAR(1.00000, *arr); free(arr); }
CTEST(total, id_19) { // When float res_a = millimeters_TO_yards(a); // Then const float s = 0.6205; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_18) { // When float res_a = millimeters_TO_miles(a); // Then const float s = 0.000353; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_17) { // When float res_a = millimeters_TO_arshins(a); // Then const float s = 0.797794; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_16) { // When float res_a = millimeters_TO_fathoms(a); // Then const float s = 0.265931; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_15) { // When float res_a = millimeters_TO_kilometers(a); // Then const float s = 0.000567391; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_23) { // When float res_a = meters_TO_centimeters(a); // Then const float s = 56739.100000; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_112) { // When float res_a = millimeters_TO_nanometers(a); // Then const float s = 567391000; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_213) { // When float res_a = meters_TO_angstroms(a); // Then const float s = 0.000000; ASSERT_DBL_NEAR(s, res_a); }
CTEST(test_suite, TWO_ROOTS) { const double a = 2; const double b = -3; const double c = 1; double x1, x2; short test = solve(a, b, c, &x1, &x2); double expected_x1 = 0.50; double expected_x2 = 1.00; short expected_root_number = 2; ASSERT_EQUAL(expected_root_number, test); ASSERT_DBL_NEAR(expected_x1, x1); ASSERT_DBL_NEAR(expected_x2, x2); }
CTEST(total, id_29) { // When float res_a = meters_TO_yards(a); // Then const float s = 620.506343; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_28) { // When float res_a = meters_TO_miles(a); // Then const float s = 0.35256; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_26) { // When float res_a = meters_TO_fathoms(a); // Then const float s = 265.932; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_13) { // When float res_a = millimeters_TO_centimeters(a); // Then const float s = 56.7391; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_110) { // When float res_a = millimeters_TO_foots(a); // Then const float s = 1.861519; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_111) { // When float res_a = millimeters_TO_micrometers(a); // Then const float s = 567391; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_14) { // When float res_a = millimeters_TO_decimeters(a); // Then const float s = 5.67391; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_210) { // When float res_a = meters_TO_foots(a); // Then const float s = 1861.519029; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_214) { // When float res_a = meters_TO_nauticalmiles(a); // Then const float s = 0.3064; ASSERT_DBL_NEAR(s, res_a); }
CTEST(total, id_212) { // When float res_a = meters_TO_nanometers(a); // Then const float s = 567.391; ASSERT_DBL_NEAR(s, res_a); }
CTEST(solution_of_quadratic_equations, two_root) { // Given const int a = 1; const int b = -3; const int c = 2; // When double x1, x2; const int result = sqr(a, b, c, &x1, &x2); // Then const double expected_x1 = 1, expected_x2 = 2; ASSERT_DBL_NEAR(expected_x1, x1); ASSERT_DBL_NEAR(expected_x2, x2); ASSERT_EQUAL(FOUND_2_ROOT, result); }