-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from RADAR-CNS/v0.4_release
V0.4 release
- Loading branch information
Showing
29 changed files
with
1,062 additions
and
611 deletions.
There are no files selected for viewing
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
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
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
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
43 changes: 43 additions & 0 deletions
43
src/test/java/org/radarcns/stream/collector/DoubleArrayCollectorTest.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2017 King's College London and The Hyve | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.radarcns.stream.collector; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Created by nivethika on 20-12-16. | ||
*/ | ||
public class DoubleArrayCollectorTest { | ||
|
||
private DoubleArrayCollector arrayCollector; | ||
|
||
@Before | ||
public void setUp() { | ||
this.arrayCollector = new DoubleArrayCollector(); | ||
} | ||
|
||
@Test | ||
public void add() { | ||
double[] arrayvalues = {0.15d, 1.0d, 2.0d, 3.0d}; | ||
this.arrayCollector.add(arrayvalues); | ||
|
||
assertEquals("[DoubleValueCollector{min=0.15, max=0.15, sum=0.15, count=1.0, avg=0.15, quartile=[0.15, 0.15, 0.15], iqr=0.0, history=[0.15]}, DoubleValueCollector{min=1.0, max=1.0, sum=1.0, count=1.0, avg=1.0, quartile=[1.0, 1.0, 1.0], iqr=0.0, history=[1.0]}, DoubleValueCollector{min=2.0, max=2.0, sum=2.0, count=1.0, avg=2.0, quartile=[2.0, 2.0, 2.0], iqr=0.0, history=[2.0]}, DoubleValueCollector{min=3.0, max=3.0, sum=3.0, count=1.0, avg=3.0, quartile=[3.0, 3.0, 3.0], iqr=0.0, history=[3.0]}]" , this.arrayCollector.toString()); | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
src/test/java/org/radarcns/stream/collector/DoubleValueCollectorTest.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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2017 King's College London and The Hyve | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.radarcns.stream.collector; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Created by nivethika on 20-12-16. | ||
*/ | ||
public class DoubleValueCollectorTest { | ||
|
||
private DoubleValueCollector valueCollector ; | ||
|
||
@Before | ||
public void setUp() { | ||
this.valueCollector = new DoubleValueCollector(); | ||
} | ||
|
||
@Test | ||
public void add() { | ||
valueCollector.add(10.0d); | ||
assertEquals(10.0d, valueCollector.getMin(), 0.0d); | ||
assertEquals(10.0d, valueCollector.getMax(), 0.0d); | ||
assertEquals(10.0d, valueCollector.getSum(), 0.0d); | ||
assertEquals(10.0d, valueCollector.getAvg(), 0.0d); | ||
assertEquals(0.0d, valueCollector.getIqr(), 0.0d); | ||
assertEquals(1, valueCollector.getCount(),0); | ||
|
||
valueCollector.add(15.100d); | ||
assertEquals(10.0d, valueCollector.getMin(), 0.0d); | ||
assertEquals(15.100d, valueCollector.getMax(), 0.0d); | ||
assertEquals(25.100d, valueCollector.getSum(), 0.0d); | ||
assertEquals(12.550d, valueCollector.getAvg(), 0.0d); | ||
assertEquals(5.1, valueCollector.getIqr(), 0.0d); | ||
assertEquals(2, valueCollector.getCount(),0); | ||
|
||
valueCollector.add(28.100d); | ||
assertEquals(18.1d, valueCollector.getIqr(), 0.0d); | ||
|
||
} | ||
|
||
@Test | ||
public void addFloat() { | ||
valueCollector.add(10.0234f); | ||
assertEquals(10.0234d, valueCollector.getMin(), 0.0d); | ||
assertEquals(10.0234d, valueCollector.getMax(), 0.0d); | ||
assertEquals(10.0234d, valueCollector.getSum(), 0.0d); | ||
assertEquals(10.0234d, valueCollector.getAvg(), 0.0d); | ||
assertEquals(0.0d, valueCollector.getIqr(), 0.0d); | ||
assertEquals(1, valueCollector.getCount(),0); | ||
|
||
valueCollector.add(15.0d); | ||
assertEquals(10.0234d, valueCollector.getMin(), 0.0d); | ||
assertEquals(15.0d, valueCollector.getMax(), 0.0d); | ||
assertEquals(25.0234d, valueCollector.getSum(), 0.0d); | ||
assertEquals(12.5117d, valueCollector.getAvg(), 0.0d); | ||
assertEquals(4.9766d, valueCollector.getIqr(), 0.0d); | ||
assertEquals(2, valueCollector.getCount(),0); | ||
|
||
valueCollector.add(28.100d); | ||
assertEquals(18.0766d, valueCollector.getIqr(), 0.0d); | ||
|
||
} | ||
|
||
@Test | ||
public void testAverage() { | ||
double[] input = {36.793899922141186, 36.878288191353626, 36.965575690177715, 36.988087035729855, 36.628622572158214}; | ||
for (double d : input) { | ||
valueCollector.add(d); | ||
} | ||
assertEquals(36.850894682312116, valueCollector.getAvg(), 0); | ||
} | ||
|
||
@Test | ||
public void testAverageFloat() { | ||
double[] input = {36.793899922141186, 36.878288191353626, 36.965575690177715, 36.988087035729855, 36.628622572158214}; | ||
for (double d : input) { | ||
valueCollector.add((float)d); | ||
} | ||
// converting to float will give a lower number of decimals on the double result | ||
assertEquals(36.8508954, valueCollector.getAvg(), 0); | ||
} | ||
} |
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
153 changes: 0 additions & 153 deletions
153
testing/src/main/java/org/radarcns/integration/aggregator/MockAggregator.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.