Formatting cleanup
This commit is contained in:
parent
65b47d0755
commit
ec1758ce20
222 changed files with 2739 additions and 2726 deletions
|
|
@ -37,7 +37,7 @@ public class ByteUtilTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void getShiftedBits(){
|
||||
public void getShiftedBits() {
|
||||
assertEquals(1, ByteUtil.getShiftedBits((byte)0b1000_0000, 7, 1));
|
||||
assertEquals(1, ByteUtil.getShiftedBits((byte)0b0001_0000, 4, 1));
|
||||
assertEquals(1, ByteUtil.getShiftedBits((byte)0b0000_0001, 0, 1));
|
||||
|
|
@ -49,14 +49,14 @@ public class ByteUtilTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void getBits(){
|
||||
public void getBits() {
|
||||
assertEquals(0x01, ByteUtil.getBits((byte)0x11, 1));
|
||||
assertEquals(0x03, ByteUtil.getBits((byte)0x13, 4));
|
||||
assertEquals((byte)0x55, ByteUtil.getBits((byte)0x55, 8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBitsMSB(){
|
||||
public void getBitsMSB() {
|
||||
assertEquals(0x01, ByteUtil.getBitsMSB((byte)0x80, 1));
|
||||
assertEquals(0x05, ByteUtil.getBitsMSB((byte)0x52, 4));
|
||||
assertEquals((byte)0x55, ByteUtil.getBitsMSB((byte)0x55, 8));
|
||||
|
|
@ -65,7 +65,7 @@ public class ByteUtilTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getBitsArray(){
|
||||
public void getBitsArray() {
|
||||
assertArrayEquals(new byte[]{}, ByteUtil.getBits(new byte[]{0x00}, 0));
|
||||
assertArrayEquals(new byte[]{0x00}, ByteUtil.getBits(new byte[]{}, 1));
|
||||
assertArrayEquals(new byte[]{0x00,0x00,0x00,0x00}, ByteUtil.getBits(new byte[]{0x00}, 32));
|
||||
|
|
@ -76,7 +76,7 @@ public class ByteUtilTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getReverseByteOrder(){
|
||||
public void getReverseByteOrder() {
|
||||
assertArrayEquals(new byte[]{}, ByteUtil.getReverseByteOrder(new byte[]{}));
|
||||
assertArrayEquals(new byte[]{0x11}, ByteUtil.getReverseByteOrder(new byte[]{0x11}));
|
||||
assertArrayEquals(new byte[]{0x22,0x11}, ByteUtil.getReverseByteOrder(new byte[]{0x11,0x22}));
|
||||
|
|
@ -85,7 +85,7 @@ public class ByteUtilTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void toFormattedString(){
|
||||
public void toFormattedString() {
|
||||
byte[] data = new byte[1];
|
||||
assertEquals("000 00 '. '",
|
||||
ByteUtil.toFormattedString(data));
|
||||
|
|
@ -110,7 +110,7 @@ public class ByteUtilTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void shiftLeft(){
|
||||
public void shiftLeft() {
|
||||
assertArrayEquals( new byte[]{},
|
||||
ByteUtil.shiftLeft(new byte[]{}, 4));
|
||||
assertArrayEquals( new byte[]{0b0000_0001},
|
||||
|
|
@ -128,7 +128,7 @@ public class ByteUtilTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shiftRight(){
|
||||
public void shiftRight() {
|
||||
assertArrayEquals( new byte[]{},
|
||||
ByteUtil.shiftRight(new byte[]{}, 4));
|
||||
assertArrayEquals( new byte[]{0b0000_0001},
|
||||
|
|
|
|||
|
|
@ -65,19 +65,19 @@ public class CronTimerTest {
|
|||
try{
|
||||
CronTimer.getRange("50", 1,12);
|
||||
fail("Did not receive Exception");
|
||||
} catch (IllegalArgumentException e){e.printStackTrace();} // We expect exception
|
||||
} catch (IllegalArgumentException e) {e.printStackTrace();} // We expect exception
|
||||
try{
|
||||
CronTimer.getRange("0", 1,12);
|
||||
fail("Did not receive Exception");
|
||||
} catch (IllegalArgumentException e){e.printStackTrace();} // We expect exception
|
||||
} catch (IllegalArgumentException e) {e.printStackTrace();} // We expect exception
|
||||
try{
|
||||
CronTimer.getRange("1-50", 1,12);
|
||||
fail("Did not receive Exception");
|
||||
} catch (IllegalArgumentException e){e.printStackTrace();} // We expect exception
|
||||
} catch (IllegalArgumentException e) {e.printStackTrace();} // We expect exception
|
||||
try{
|
||||
CronTimer.getRange("0-5", 3,12);
|
||||
fail("Did not receive Exception");
|
||||
} catch (IllegalArgumentException e){e.printStackTrace();} // We expect exception
|
||||
} catch (IllegalArgumentException e) {e.printStackTrace();} // We expect exception
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -89,14 +89,14 @@ public class CronTimerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void minuteWildcard(){
|
||||
public void minuteWildcard() {
|
||||
CronTimer cron = getCronTimer("0 * * * * *");
|
||||
assertEquals(1041382800000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041382800000L, (long)cron.next(1041379260000L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hourWildcard(){
|
||||
public void hourWildcard() {
|
||||
CronTimer cron = getCronTimer("* 0 * * * *");
|
||||
assertEquals(1041379260000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041379320000L, (long)cron.next(1041379260000L)); // minute change
|
||||
|
|
@ -105,7 +105,7 @@ public class CronTimerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void dayWildcard(){
|
||||
public void dayWildcard() {
|
||||
CronTimer cron = getCronTimer("* * 1 * * *");
|
||||
assertEquals(1041379260000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041379320000L, (long)cron.next(1041379260000L)); // minute change
|
||||
|
|
@ -113,7 +113,7 @@ public class CronTimerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void monthWildcard(){
|
||||
public void monthWildcard() {
|
||||
CronTimer cron = getCronTimer("* * * 1 * *");
|
||||
assertEquals(1041379260000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041382860000L, (long)cron.next(1041382800000L)); // hour change
|
||||
|
|
@ -122,14 +122,14 @@ public class CronTimerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void weekDayWildcard(){
|
||||
public void weekDayWildcard() {
|
||||
CronTimer cron = getCronTimer("* * * * 3 *");
|
||||
assertEquals(1041379260000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041984000000L, (long)cron.next(1041465600000L)); // day change
|
||||
}
|
||||
|
||||
@Test
|
||||
public void yearWildcard(){
|
||||
public void yearWildcard() {
|
||||
CronTimer cron = getCronTimer("* * * * * 2003");
|
||||
assertEquals(1041379260000L, (long)cron.next(1041379200000L));
|
||||
assertEquals(1041379320000L, (long)cron.next(1041379260000L)); // min change
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class EncrypterTest {
|
|||
|
||||
|
||||
|
||||
public static String encryptDecrypt(Encrypter encrypter, Encrypter decrypter, String data){
|
||||
public static String encryptDecrypt(Encrypter encrypter, Encrypter decrypter, String data) {
|
||||
byte[] encrypted = encrypter.encrypt(data.getBytes());
|
||||
byte[] decrypted = decrypter.decrypt(encrypted);
|
||||
return new String(decrypted);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import static org.junit.Assert.assertEquals;
|
|||
public class HasherTest {
|
||||
|
||||
@Test
|
||||
public void MD5Test(){
|
||||
public void MD5Test() {
|
||||
assertEquals(Hasher.MD5("AAAABBBB"), "9da4fc50e09e5eeb8ae8149ef4f23792");
|
||||
assertEquals(Hasher.MD5("qwerty12345"),"85064efb60a9601805dcea56ec5402f7");
|
||||
assertEquals(Hasher.MD5("123456789"), "25f9e794323b453885f5181f1b624d0b");
|
||||
|
|
@ -40,7 +40,7 @@ public class HasherTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void SHA1Test(){
|
||||
public void SHA1Test() {
|
||||
assertEquals(Hasher.SHA1("AAAABBBB"), "7cd188ef3a9ea7fa0ee9c62c168709695460f5c0");
|
||||
assertEquals(Hasher.SHA1("qwerty12345"),"4e17a448e043206801b95de317e07c839770c8b8");
|
||||
assertEquals(Hasher.SHA1("123456789"), "f7c3bc1d808e04732adf679965ccc34ca7ae3441");
|
||||
|
|
@ -48,7 +48,7 @@ public class HasherTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void PBKDF2(){
|
||||
public void PBKDF2() {
|
||||
assertEquals(Hasher.PBKDF2("AAAABBBB", "s", 1000),
|
||||
"8da1853fe2a2efc82aa444e7274b74cf25190e580898bbaac83c502099506dd7");
|
||||
assertEquals(Hasher.PBKDF2("AAAABBBB", "salt", 1000),
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class StringUtilTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void joinTest(){
|
||||
public void joinTest() {
|
||||
assertEquals("", StringUtil.join(",", Collections.emptyList()));
|
||||
assertEquals("1,2,3,4,5", StringUtil.join(",", 1,2,3,4,5));
|
||||
assertEquals("1,2,3,4,5", StringUtil.join(",", Arrays.asList(1,2,3,4,5)));
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import java.util.Arrays;
|
|||
* TODO: Convert to JUnit
|
||||
*/
|
||||
public class QuickSelectTest {
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
int[] array = {1,3,4,6,3,2,98,5,7,8,543,2,4,5,8,9,5,2,3,5,7,5,3,2,6,8,5,324,8,6};
|
||||
//int[] array = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,18,19,20};
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public class QuickSelectTest {
|
|||
System.out.println("RightAnswer("+(System.currentTimeMillis()-time)+"ms): "+array[array.length/2]);
|
||||
|
||||
System.out.println("Sorted Array("+array.length+"): ");
|
||||
for(int i=0; i<array.length ;i++){
|
||||
for(int i=0; i<array.length ;i++) {
|
||||
System.out.println(array[i] +",");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import java.io.File;
|
|||
|
||||
|
||||
public class ExternalSortTest {
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
File file = new File("C:\\Users\\Ziver\\Desktop\\IndexFile.txt");
|
||||
File sortedFile = new File("C:\\Users\\Ziver\\Desktop\\SortedIndexFile.txt");
|
||||
|
|
|
|||
|
|
@ -32,14 +32,14 @@ public class MergeSortTest {
|
|||
public static final int SIZE = 10000;
|
||||
public static final int MAX_INT = 10000;
|
||||
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
int[] array = new int[SIZE];
|
||||
|
||||
for(int i=0; i<array.length ;i++){
|
||||
for(int i=0; i<array.length ;i++) {
|
||||
array[i] = (int)(Math.random()*MAX_INT);
|
||||
}
|
||||
|
||||
for(int i=0; i<array.length ;i++){
|
||||
for(int i=0; i<array.length ;i++) {
|
||||
System.out.print(array[i]+", ");
|
||||
}
|
||||
|
||||
|
|
@ -53,18 +53,18 @@ public class MergeSortTest {
|
|||
time = System.currentTimeMillis() - time;
|
||||
|
||||
System.out.println("\n--------------------------------------------");
|
||||
System.out.print(array[0]+", ");
|
||||
System.out.print(array[0] + ", ");
|
||||
int error = -1;
|
||||
for(int i=1; i<array.length ;i++){
|
||||
System.out.print(array[i]+", ");
|
||||
if(array[i-1] > array[i]){
|
||||
for(int i=1; i<array.length; i++) {
|
||||
System.out.print(array[i] + ", ");
|
||||
if (array[i-1] > array[i]) {
|
||||
error = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(error >= 0){
|
||||
System.out.println("\nArray not sorted!! ("+array[error-1]+" > "+array[error]+")");
|
||||
if (error >= 0) {
|
||||
System.out.println("\nArray not sorted!! (" + array[error-1] + " > " + array[error] + ")");
|
||||
}
|
||||
System.out.println("\nTime: "+time+" ms");
|
||||
System.out.println("\nTime: " + time + " ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class AnonymousFunctionBenchmark {
|
|||
|
||||
@Test
|
||||
public void functionLoop() {
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = new CalcFunc(){
|
||||
public int calc(int i){
|
||||
|
|
@ -59,7 +59,7 @@ public class AnonymousFunctionBenchmark {
|
|||
}
|
||||
};
|
||||
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = func.calc(i);
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class AnonymousFunctionBenchmark {
|
|||
|
||||
@Test
|
||||
public void rawLoops(){
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class LoopBenchmark {
|
|||
|
||||
@Test
|
||||
public void writeArrayOneLoop() {
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < Math.max(array1.length, array1.length); i++) {
|
||||
if (i < array1.length)
|
||||
array1[i] = i;
|
||||
|
|
@ -53,7 +53,7 @@ public class LoopBenchmark {
|
|||
|
||||
@Test
|
||||
public void writeArraySeparateLoops(){
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < array1.length; i++) {
|
||||
array1[i] = i;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ public class LoopBenchmark {
|
|||
@Test
|
||||
public void readArrayLoop() {
|
||||
int sum = 0;
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i = 0; i < array1.length; i++) {
|
||||
sum += array1[i];
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class LoopBenchmark {
|
|||
@Test
|
||||
public void readArrayForeach() {
|
||||
int sum = 0;
|
||||
for(int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int k=0; k<TEST_EXECUTIONS; k++) {
|
||||
for (int i : array1) {
|
||||
sum += array1[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,20 +49,20 @@ public class StringSplitBenchmark {
|
|||
|
||||
@Test
|
||||
public void stringSplit(){
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++)
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++)
|
||||
assertSplit(str.split(delimiter));
|
||||
}
|
||||
|
||||
public static Pattern pattern = Pattern.compile(delimiter);
|
||||
@Test
|
||||
public void patternSplit(){
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++)
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++)
|
||||
assertSplit(pattern.split(str));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void substring(){
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++) {
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++) {
|
||||
List<String> splitList = StringUtil.split(str, delimiter.charAt(0));
|
||||
assertSplit(splitList.toArray(new String[0]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,8 +197,8 @@ public class BufferedBoundaryInputStreamTest {
|
|||
|
||||
int out;
|
||||
StringBuilder output = new StringBuilder();
|
||||
while((out = in.read()) != -1){
|
||||
output.append((char)out);
|
||||
while ((out = in.read()) != -1){
|
||||
output.append((char) out);
|
||||
}
|
||||
assertEquals(data, output.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class FileChangedTest implements FileWatcher.FileChangeListener {
|
|||
FileWatcher watcher = new FileWatcher(FileUtil.find("test.txt"));
|
||||
watcher.setListener(new FileChangedTest());
|
||||
|
||||
while(true){
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
|||
|
|
@ -35,25 +35,25 @@ import static org.junit.Assert.assertEquals;
|
|||
public class MatrixTest {
|
||||
|
||||
@Test
|
||||
public void scalarAdd(){
|
||||
public void scalarAdd() {
|
||||
assertArrayEquals(new double[][]{{4,5},{-2,11}},
|
||||
Matrix.add(new double[][]{{2,3},{-4,9}}, 2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scalarSubtraction(){
|
||||
public void scalarSubtraction() {
|
||||
assertArrayEquals(new double[][]{{0,1},{-6,7}},
|
||||
Matrix.subtract(new double[][]{{2,3},{-4,9}}, 2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scalarMultiply(){
|
||||
public void scalarMultiply() {
|
||||
assertArrayEquals(new double[][]{{4,6},{-8,18}},
|
||||
Matrix.multiply(new double[][]{{2,3},{-4,9}}, 2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void scalarDivision(){
|
||||
public void scalarDivision() {
|
||||
assertArrayEquals(new double[][]{{1,2},{-2,5}},
|
||||
Matrix.divide(new double[][]{{2,4},{-4,10}}, 2));
|
||||
}
|
||||
|
|
@ -61,25 +61,25 @@ public class MatrixTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void elementalAdd(){
|
||||
public void elementalAdd() {
|
||||
assertArrayEquals(new double[][]{{3,5},{-1,13}},
|
||||
Matrix.Elemental.add(new double[][]{{2,3},{-4,9}}, new double[][]{{1,2},{3,4}}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elementalSubtract(){
|
||||
public void elementalSubtract() {
|
||||
assertArrayEquals(new double[][]{{1,1},{-7,5}},
|
||||
Matrix.Elemental.subtract(new double[][]{{2,3},{-4,9}}, new double[][]{{1,2},{3,4}}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elementalMultiply(){
|
||||
public void elementalMultiply() {
|
||||
assertArrayEquals(new double[][]{{2,6},{-12,36}},
|
||||
Matrix.Elemental.multiply(new double[][]{{2,3},{-4,9}}, new double[][]{{1,2},{3,4}}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void elementalVectorPow(){
|
||||
public void elementalVectorPow() {
|
||||
assertArrayEquals(
|
||||
new double[]{4,9,16,81},
|
||||
Matrix.Elemental.pow(new double[]{2,3,-4,9}, 2),
|
||||
|
|
@ -87,7 +87,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void elementalMatrixPow(){
|
||||
public void elementalMatrixPow() {
|
||||
assertArrayEquals(new double[][]{{4,9},{16,81}},
|
||||
Matrix.Elemental.pow(new double[][]{{2,3},{-4,9}}, 2));
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ public class MatrixTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void vectorAddition(){
|
||||
public void vectorAddition() {
|
||||
assertArrayEquals(
|
||||
new double[]{3,5,-1,13},
|
||||
Matrix.add(new double[]{2,3,-4,9}, new double[]{1,2,3,4}),
|
||||
|
|
@ -104,7 +104,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixAddition(){
|
||||
public void vectorMatrixAddition() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{2,3,4,5},{2,3,4,5},{2,3,4,5},{2,3,4,5}},
|
||||
Matrix.add(new double[][]{{1,2,3,4},{1,2,3,4},{1,2,3,4},{1,2,3,4}}, new double[]{1,1,1,1})
|
||||
|
|
@ -112,7 +112,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorSubtraction(){
|
||||
public void vectorSubtraction() {
|
||||
assertArrayEquals(
|
||||
new double[]{1,1,-7,5},
|
||||
Matrix.subtract(new double[]{2,3,-4,9}, new double[]{1,2,3,4}),
|
||||
|
|
@ -121,7 +121,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixSubtraction(){
|
||||
public void vectorMatrixSubtraction() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{0,1,2,3},{0,1,2,3},{0,1,2,3},{0,1,2,3}},
|
||||
Matrix.subtract(new double[][]{{1,2,3,4},{1,2,3,4},{1,2,3,4},{1,2,3,4}}, new double[]{1,1,1,1})
|
||||
|
|
@ -129,7 +129,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMultiply(){
|
||||
public void vectorMultiply() {
|
||||
assertArrayEquals(
|
||||
new double[]{0.1, 0.4, 0.9, 1.6},
|
||||
Matrix.Elemental.multiply(
|
||||
|
|
@ -139,7 +139,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixMultiply(){
|
||||
public void vectorMatrixMultiply() {
|
||||
assertArrayEquals(
|
||||
new double[]{1.4, 1.9, 2.4, 2.9},
|
||||
Matrix.multiply(
|
||||
|
|
@ -149,7 +149,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixDivision(){
|
||||
public void vectorMatrixDivision() {
|
||||
assertArrayEquals(
|
||||
new double[]{4,1},
|
||||
Matrix.divide(new double[][]{{2,4},{-4,10}}, new double[]{1,2}),
|
||||
|
|
@ -158,7 +158,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixElementalMultiply(){
|
||||
public void vectorMatrixElementalMultiply() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{1, 4, 9}, {1, 6, 12}, {1, 8, 15}, {1, 10, 18}},
|
||||
Matrix.Elemental.multiply(
|
||||
|
|
@ -167,7 +167,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorMatrixElementalDivision(){
|
||||
public void vectorMatrixElementalDivision() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{2,2},{-4,5}},
|
||||
Matrix.Elemental.divide(
|
||||
|
|
@ -176,7 +176,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void vectorSum(){
|
||||
public void vectorSum() {
|
||||
assertEquals(
|
||||
20.0,
|
||||
Matrix.sum(new double[]{1,2,0,3,5,9}),
|
||||
|
|
@ -187,7 +187,7 @@ public class MatrixTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void matrixMultiply(){
|
||||
public void matrixMultiply() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{486,410.4,691.6},{314,341.6,416.4},{343.5,353.4,463.6},{173,285.2,190.8}},
|
||||
Matrix.multiply(
|
||||
|
|
@ -197,7 +197,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void matrixTranspose(){
|
||||
public void matrixTranspose() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{1,3},{2,5},{0,9}},
|
||||
Matrix.transpose(
|
||||
|
|
@ -206,7 +206,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void matrixSum(){
|
||||
public void matrixSum() {
|
||||
assertEquals(
|
||||
20.0,
|
||||
Matrix.sum(new double[][]{{1,2,0},{3,5,9}}),
|
||||
|
|
@ -217,7 +217,7 @@ public class MatrixTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void identity(){
|
||||
public void identity() {
|
||||
assertArrayEquals(
|
||||
new double[][]{{1}},
|
||||
Matrix.identity(1));
|
||||
|
|
@ -228,7 +228,7 @@ public class MatrixTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getColumn(){
|
||||
public void getColumn() {
|
||||
assertArrayEquals(
|
||||
new double[]{2,3,4,1},
|
||||
Matrix.getColumn(new double[][]{{1,2,3,4},{2,3,4,1},{3,4,1,2},{4,1,2,3}}, 1),
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class ServerFindClientTest {
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ServerFindClient client = new ServerFindClient(2000);
|
||||
System.out.println(client.find().getHostAddress());
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import java.io.IOException;
|
|||
|
||||
|
||||
public class ServerFindServerTest {
|
||||
public static void main(String[] args){
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new ServerFind(2000);
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class HttpGuessTheNumber implements HttpPage {
|
|||
String low = cookie.get(COOKIE_KEY_LOW);
|
||||
String high = cookie.get(COOKIE_KEY_HIGH);
|
||||
|
||||
if(session.containsKey(SESSION_KEY_NUMBER)){
|
||||
if (session.containsKey(SESSION_KEY_NUMBER)){
|
||||
if (request.containsKey(REQUEST_KEY_GUESS)) {
|
||||
int guess = Integer.parseInt(request.get(REQUEST_KEY_GUESS));
|
||||
int number = (Integer) session.get(SESSION_KEY_NUMBER);
|
||||
|
|
@ -94,7 +94,7 @@ public class HttpGuessTheNumber implements HttpPage {
|
|||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
session.put(SESSION_KEY_NUMBER, (int)(Math.random()*99+1));
|
||||
low = "0";
|
||||
high = "100";
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class OAuth2TokenPageTest {
|
|||
private OAuth2TokenPage tokenPage;
|
||||
|
||||
@Before
|
||||
public void init(){
|
||||
public void init() {
|
||||
registry = new OAuth2Registry();
|
||||
tokenPage = new OAuth2TokenPage(registry);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class NetworkClientTest {
|
|||
client.setDefaultWorker(worker);
|
||||
|
||||
Thread.sleep(1000);
|
||||
while(time > System.currentTimeMillis()){
|
||||
while (time > System.currentTimeMillis()){
|
||||
PrintResponseHandler handler = new PrintResponseHandler();
|
||||
worker.send(client.getRemoteAddress(),
|
||||
new StringResponseMessage("StringResponseMessage: "+count),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class NetworkServerTest {
|
|||
NioServer server = new NioServer(6056);
|
||||
server.setDefaultWorker(new StandardWorker(server));
|
||||
|
||||
while(true){
|
||||
while (true){
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import static org.junit.Assert.assertEquals;
|
|||
public class RESTHttpPageTest {
|
||||
|
||||
public static class TestClass implements WSInterface{
|
||||
public String hello(){
|
||||
public String hello() {
|
||||
return "hello world";
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ public class RESTHttpPageTest {
|
|||
|
||||
|
||||
public static class TestEchoClass implements WSInterface{
|
||||
public String echo(@WSParamName("input") String input){
|
||||
public String echo(@WSParamName("input") String input) {
|
||||
return "echo: "+input;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ public class CSVParserTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void emptyTest(){
|
||||
public void emptyTest() {
|
||||
DataNode node = CSVParser.read("");
|
||||
assertNull(node);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleTest(){
|
||||
public void simpleTest() {
|
||||
DataNode node = CSVParser.read("hello,world,you");
|
||||
assertEquals(3, node.size());
|
||||
assertEquals("hello", node.get(0).getString());
|
||||
|
|
@ -83,7 +83,7 @@ public class CSVParserTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void quotedTest(){
|
||||
public void quotedTest() {
|
||||
DataNode node = CSVParser.read("\"hello\",\"world\",\"you\"");
|
||||
assertEquals(3, node.size());
|
||||
assertEquals("hello", node.get(0).getString());
|
||||
|
|
@ -92,7 +92,7 @@ public class CSVParserTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void quotedIncorrectlyTest(){
|
||||
public void quotedIncorrectlyTest() {
|
||||
DataNode node = CSVParser.read("hello\",wo\"rl\"d,\"you\"");
|
||||
assertEquals(3, node.size());
|
||||
assertEquals("hello\"", node.get(0).getString());
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.Assert.assertNull;
|
|||
public class URLDecoderTest {
|
||||
|
||||
@Test
|
||||
public void simpleTest(){
|
||||
public void simpleTest() {
|
||||
assertNull(URLDecoder.decode(null));
|
||||
assertEquals("", URLDecoder.decode(""));
|
||||
assertEquals("space space", URLDecoder.decode("space space"));
|
||||
|
|
@ -44,7 +44,7 @@ public class URLDecoderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void percentTest(){
|
||||
public void percentTest() {
|
||||
assertEquals("test+", URLDecoder.decode("test%2B"));
|
||||
assertEquals("test%2", URLDecoder.decode("test%2"));
|
||||
assertEquals("test+test", URLDecoder.decode("test%2Btest"));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class JSONSerializerBenchmark {
|
|||
|
||||
@Test
|
||||
public void testJavaLegacySerialize() throws IOException, ClassNotFoundException{
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++){
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++){
|
||||
TestClass sourceObj = new TestClass().init();
|
||||
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
|
|
@ -61,7 +61,7 @@ public class JSONSerializerBenchmark {
|
|||
|
||||
@Test
|
||||
public void testJavaJSONSerialize() throws IOException {
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++){
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++){
|
||||
TestClass sourceObj = new TestClass().init();
|
||||
|
||||
TestClass targetObj = JSONSerializerTest.sendReceiveObject(sourceObj);
|
||||
|
|
@ -72,7 +72,7 @@ public class JSONSerializerBenchmark {
|
|||
|
||||
@Test
|
||||
public void testOutputJavaLegacySerialize() throws IOException {
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++){
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++){
|
||||
TestClass sourceObj = new TestClass().init();
|
||||
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
|
|
@ -86,7 +86,7 @@ public class JSONSerializerBenchmark {
|
|||
|
||||
@Test
|
||||
public void testOutputJavaJSONSerialize() throws IOException {
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++){
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++){
|
||||
TestClass sourceObj = new TestClass().init();
|
||||
|
||||
String targetObj = JSONSerializerTest.writeObjectToJson(sourceObj);
|
||||
|
|
@ -104,7 +104,7 @@ public class JSONSerializerBenchmark {
|
|||
out.close();
|
||||
byte[] data = bout.toByteArray();
|
||||
|
||||
for(int i=0; i<TEST_EXECUTIONS; i++){
|
||||
for (int i=0; i<TEST_EXECUTIONS; i++){
|
||||
ByteArrayInputStream bin = new ByteArrayInputStream(data);
|
||||
ObjectInputStream in = new ObjectInputStream(bin);
|
||||
TestClass targetObj = (TestClass) in.readObject();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class ConsoleTest {
|
|||
terminal.enableTray(true);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
while(true){
|
||||
while (true){
|
||||
System.out.println("hello= "+in.readLine());
|
||||
for(int i=0; i<2 ;i++){
|
||||
System.out.println(i+"Hello World!!!sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue