| 21 | |
| 22 | |
| 23 | int main(int argc, char** argv) { |
| 24 | { |
| 25 | double a[] = {3, 4, 5}; |
| 26 | double b[] = {-1, 9, -2.5}; |
| 27 | double found = dot_product(3, a, b); |
| 28 | double expected = 20.5; |
| 29 | printf("Found %f, Expected %f\n", found, expected); |
| 30 | assert(fabs(found - expected) < 0.01); |
| 31 | } |
| 32 | |
| 33 | { |
| 34 | double a[] = {0, 0, 0}; |
| 35 | double b[] = {1, 1, 1}; |
| 36 | double found = dot_product(3, a, b); |
| 37 | double expected = 0; |
| 38 | printf("Found %f, Expected %f\n", found, expected); |
| 39 | assert(fabs(found - expected) < 0.01); |
| 40 | } |
| 41 | |
| 42 | { |
| 43 | double a[] = {-1, -1, -1}; |
| 44 | double b[] = {1, 1, 1}; |
| 45 | double found = dot_product(3, a, b); |
| 46 | double expected = -3; |
| 47 | printf("Found %f, Expected %f\n", found, expected); |
| 48 | assert(fabs(found - expected) < 0.01); |
| 49 | } |
| 50 | |
| 51 | return 0; |
| 52 | } |
nothing calls this directly
no test coverage detected