|
int main() {
|
|
printf("=== Trigonometric Functions Tests ===\n");
|
|
printf("Note: Results are scaled by 1,000,000\n");
|
|
|
|
printf("Test 1: sin() function\n");
|
|
int sin0 = sin(0);
|
|
printf("sin(0) * 1000000 = %d\n", sin0);
|
|
int sin1 = sin(1);
|
|
printf("sin(1) * 1000000 = %d\n", sin1);
|
|
int sin2 = sin(2);
|
|
printf("sin(2) * 1000000 = %d\n", sin2);
|
|
printf("PASS: sin() function works\n");
|
|
|
|
printf("Test 2: cos() function\n");
|
|
int cos0 = cos(0);
|
|
printf("cos(0) * 1000000 = %d\n", cos0);
|
|
int cos1 = cos(1);
|
|
printf("cos(1) * 1000000 = %d\n", cos1);
|
|
int cos2 = cos(2);
|
|
printf("cos(2) * 1000000 = %d\n", cos2);
|
|
printf("PASS: cos() function works\n");
|
|
|
|
printf("Test 3: tan() function\n");
|
|
int tan0 = tan(0);
|
|
printf("tan(0) * 1000000 = %d\n", tan0);
|
|
int tan1 = tan(1);
|
|
printf("tan(1) * 1000000 = %d\n", tan1);
|
|
printf("PASS: tan() function works\n");
|
|
|
|
printf("Test 4: Multiple angles\n");
|
|
int i = 0;
|
|
while (i < 4) {
|
|
int s = sin(i);
|
|
int c = cos(i);
|
|
printf("Angle %d: sin = %d, cos = %d\n", i, s, c);
|
|
i = i + 1;
|
|
}
|
|
printf("PASS: Multiple angle calculations work\n");
|
|
|
|
printf("Test 5: Trig with negative values\n");
|
|
int sinNeg = sin(-1);
|
|
printf("sin(-1) * 1000000 = %d\n", sinNeg);
|
|
int cosNeg = cos(-1);
|
|
printf("cos(-1) * 1000000 = %d\n", cosNeg);
|
|
printf("PASS: Negative angle calculations work\n");
|
|
|
|
printf("\n=== All Trigonometric Tests Completed ===\n");
|
|
return 0;
|
|
}
|