-
Notifications
You must be signed in to change notification settings - Fork 158
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 #299 from enviroCar/develop
Develop
- Loading branch information
Showing
11 changed files
with
97 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## This file is automatically generated by Android Studio. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must *NOT* be checked into Version Control Systems, | ||
# as it contains information specific to your local configuration. | ||
# | ||
# Location of the SDK. This is only used by Gradle. | ||
# For customization when using a Version Control System, please read the | ||
# header note. | ||
#Tue Jan 26 12:51:21 CET 2016 | ||
sdk.dir=/home/matthes/opt/android/sdk | ||
org.gradle.jvmargs=-Xmx2048M |
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
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
31 changes: 0 additions & 31 deletions
31
org.envirocar.storage/src/androidTest/java/org/envirocar/storage/ApplicationTest.java
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
org.envirocar.storage/src/androidTest/java/org/envirocar/storage/MeasurementTableTest.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,57 @@ | ||
/** | ||
* Copyright (C) 2013 - 2015 the enviroCar community | ||
* | ||
* This file is part of the enviroCar app. | ||
* | ||
* The enviroCar app is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The enviroCar app is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with the enviroCar app. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package org.envirocar.storage; | ||
|
||
import android.content.ContentValues; | ||
import android.test.InstrumentationTestCase; | ||
|
||
import org.envirocar.core.entity.Measurement; | ||
import org.envirocar.core.entity.MeasurementImpl; | ||
import org.envirocar.core.entity.Track; | ||
import org.hamcrest.CoreMatchers; | ||
import org.json.JSONObject; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* To work on unit tests, switch the Test Artifact in the Build Variants view. | ||
*/ | ||
public class MeasurementTableTest extends InstrumentationTestCase { | ||
|
||
@Test | ||
public void testInfinityValuePassing() throws Exception { | ||
MeasurementImpl m = new MeasurementImpl(); | ||
m.setTrackId(new Track.TrackId(1)); | ||
m.setProperty(Measurement.PropertyKey.CALCULATED_MAF, Double.POSITIVE_INFINITY); | ||
m.setProperty(Measurement.PropertyKey.CO2, Double.POSITIVE_INFINITY); | ||
m.setProperty(Measurement.PropertyKey.SPEED, Double.MAX_VALUE); | ||
m.setProperty(Measurement.PropertyKey.CONSUMPTION, 1.1); | ||
ContentValues vals = MeasurementTable.toContentValues(m); | ||
|
||
Object props = vals.get(MeasurementTable.KEY_PROPERTIES); | ||
|
||
JSONObject obj = new JSONObject(props.toString()); | ||
|
||
Assert.assertThat(obj.get(Measurement.PropertyKey.CONSUMPTION.name()), CoreMatchers.is(1.1)); | ||
Assert.assertThat(obj.get(Measurement.PropertyKey.SPEED.name()), CoreMatchers.is(Double.MAX_VALUE)); | ||
Assert.assertThat(obj.has(Measurement.PropertyKey.CALCULATED_MAF.name()), CoreMatchers.is(false)); | ||
Assert.assertThat(obj.has(Measurement.PropertyKey.CO2.name()), CoreMatchers.is(false)); | ||
} | ||
|
||
} |
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
33 changes: 0 additions & 33 deletions
33
org.envirocar.storage/src/test/java/org/envirocar/storage/ExampleUnitTest.java
This file was deleted.
Oops, something went wrong.