-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
24 deletions.
There are no files selected for viewing
53 changes: 29 additions & 24 deletions
53
app/src/test/java/net/osmtracker/util/ArrayUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
package net.osmtracker.util; | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.*; | ||
import org.junit.Test; | ||
|
||
public class ArrayUtilsTest { | ||
|
||
double data[][] = { | ||
{1,1,1}, | ||
{2,2,2}, | ||
{3,3,3} | ||
}; | ||
|
||
@Test | ||
public void findMin() { | ||
|
||
double min = ArrayUtils.findMin(data, 0); | ||
assertTrue(min == 1); | ||
|
||
} | ||
|
||
@Test | ||
public void findMax() { | ||
|
||
double max = ArrayUtils.findMax(data, 0); | ||
assertTrue(max == 3); | ||
|
||
} | ||
double[][] arrayAsc = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}}; | ||
|
||
double[][] arrayDesc = {{3, 3, 3}, {2, 2, 2}, {1, 1, 1}}; | ||
|
||
@Test | ||
public void findMinAsc() { | ||
double min = ArrayUtils.findMin(arrayAsc, 0); | ||
assertTrue(min == 1); | ||
} | ||
|
||
@Test | ||
public void findMinDesc() { | ||
double min = ArrayUtils.findMin(arrayDesc, 2); | ||
assertTrue(min == 1); | ||
} | ||
|
||
@Test | ||
public void findMaxAsc() { | ||
double max = ArrayUtils.findMax(arrayAsc, 0); | ||
assertTrue(max == 3); | ||
} | ||
|
||
@Test | ||
public void findMaxDesc() { | ||
double max = ArrayUtils.findMax(arrayDesc, 2); | ||
assertTrue(max == 3); | ||
} | ||
} |