Datasets:
Download raw/java/cwe_1041_0_funct_test.java from amazon/AutoSUIT: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/java/cwe_1041_0_funct_test.java
- Command line
-
hf download hf://datasets/amazon/AutoSUIT/raw/java/cwe_1041_0_funct_test.java
-
curl -L -o cwe_1041_0_funct_test.java https://huggingface.co/datasets/amazon/AutoSUIT/resolve/main/raw/java/cwe_1041_0_funct_test.java
1.58 kB
| import org.junit.jupiter.api.*; | |
| import static org.junit.jupiter.api.Assertions.*; | |
| import static org.mockito.Mockito.*; | |
| class SurfaceAreaCalculatorTest { | |
| // Test for r = 1.0, s = 10.0 | |
| void testCalculateSurfaceAreaWithR1() { | |
| double r = 1.0; | |
| double s = 10.0; | |
| double pi = 3.14159; | |
| // Expected result calculated in the description | |
| double expected = 34.55749; | |
| // Invoke the method and assert the expected result | |
| double result = SurfaceAreaCalculator.calculateSurfaceArea(r, s, pi); | |
| assertEquals(expected, result, 0.00001); | |
| } | |
| // Test for r = 2.0, s = 10.0 | |
| void testCalculateSurfaceAreaWithR2() { | |
| double r = 2.0; | |
| double s = 10.0; | |
| double pi = 3.14159; | |
| // Expected result calculated in the description | |
| double expected = 75.39816; | |
| // Invoke the method and assert the expected result | |
| double result = SurfaceAreaCalculator.calculateSurfaceArea(r, s, pi); | |
| assertEquals(expected, result, 0.00001); | |
| } | |
| // Test for r = 0.5, s = 10.0 | |
| void testCalculateSurfaceAreaWithR0_5() { | |
| double r = 0.5; | |
| double s = 10.0; | |
| double pi = 3.14159; | |
| // Expected result calculated in the description | |
| double expected = 16.4933475; | |
| // Invoke the method and assert the expected result | |
| double result = SurfaceAreaCalculator.calculateSurfaceArea(r, s, pi); | |
| assertEquals(expected, result, 0.00001); | |
| } | |
| } | |