Upload project.
This commit is contained in:
74
test/strategy_pattern_tests/ChemicalScannerTest.java
Normal file
74
test/strategy_pattern_tests/ChemicalScannerTest.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.MaterialSample;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.materialsampler.ChemicalScanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class ChemicalScannerTest {
|
||||
|
||||
@Test
|
||||
public void validMassTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
ChemicalScanner equipment = new ChemicalScanner(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass());
|
||||
assertTrue(current.getMass() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
ChemicalScanner equipment = new ChemicalScanner(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getDensity());
|
||||
assertTrue(current.getDensity() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
ChemicalScanner equipment = new ChemicalScanner(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass() + " " + current.getDensity());
|
||||
assertEquals(current.getMass(),current.getDensity() * 0.5, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
test/strategy_pattern_tests/HotFluidSamplerTest.java
Normal file
74
test/strategy_pattern_tests/HotFluidSamplerTest.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.MaterialSample;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.materialsampler.HotFluidSampler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class HotFluidSamplerTest {
|
||||
|
||||
@Test
|
||||
public void validMassTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
HotFluidSampler equipment = new HotFluidSampler(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass());
|
||||
assertTrue(current.getMass() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
HotFluidSampler equipment = new HotFluidSampler(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getDensity());
|
||||
assertTrue(current.getDensity() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
HotFluidSampler equipment = new HotFluidSampler(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass() + " " + current.getDensity());
|
||||
assertEquals(current.getMass(),current.getDensity() * 0.5, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
test/strategy_pattern_tests/IndexOfRefractionTest.java
Normal file
74
test/strategy_pattern_tests/IndexOfRefractionTest.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.IndexOfRefractionReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.waterreadings.IndexOfRefraction;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class IndexOfRefractionTest {
|
||||
|
||||
@Test
|
||||
public void validAngleTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
IndexOfRefraction equipment = new IndexOfRefraction(submersible, 30);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
IndexOfRefractionReading current = (IndexOfRefractionReading) data[i];
|
||||
System.out.println(current.getAngleOfRefraction());
|
||||
assertTrue(current.getAngleOfRefraction() >= 0 && current.getAngleOfRefraction() <= 90);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validIndexTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
IndexOfRefraction equipment = new IndexOfRefraction(submersible,30);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
IndexOfRefractionReading current = (IndexOfRefractionReading) data[i];
|
||||
System.out.println(current.getIndexOfRefraction());
|
||||
assertTrue(current.getAngleOfRefraction() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctIndexTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
IndexOfRefraction equipment = new IndexOfRefraction(submersible,30);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
IndexOfRefractionReading current = (IndexOfRefractionReading) data[i];
|
||||
System.out.println(current.getAngleOfRefraction() + " " + current.getIndexOfRefraction());
|
||||
assertEquals(current.getIndexOfRefraction(), 30 / current.getAngleOfRefraction(),0);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
test/strategy_pattern_tests/LaserTest.java
Normal file
74
test/strategy_pattern_tests/LaserTest.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.LaserReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.topographicalmapper.Laser;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class LaserTest {
|
||||
|
||||
@Test
|
||||
public void validAngleTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Laser equipment = new Laser(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
LaserReading current = (LaserReading) data[i];
|
||||
System.out.println(current.getAngle());
|
||||
assertTrue(current.getAngle() >= 0 && current.getAngle() <= 90);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctDepthTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Laser equipment = new Laser(submersible,0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
LaserReading current = (LaserReading) data[i];
|
||||
System.out.println(current.getAngle() + " " + current.getDepth());
|
||||
assertEquals(current.getDepth(), 0.5 / Math.tan(current.getAngle() / (180/Math.PI)),0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validDepthTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Laser equipment = new Laser(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
LaserReading current = (LaserReading) data[i];
|
||||
System.out.println(current.getDepth());
|
||||
assertTrue(current.getDepth() >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
test/strategy_pattern_tests/PhotosensorTest.java
Normal file
38
test/strategy_pattern_tests/PhotosensorTest.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.PhotoSensorReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.PhotoSensor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class PhotosensorTest {
|
||||
|
||||
@Test
|
||||
public void validPhotosensorTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
PhotoSensor equipment = new PhotoSensor(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
PhotoSensorReading current = (PhotoSensorReading) data[i];
|
||||
System.out.println(current.getReading());
|
||||
assertTrue(current.getReading() >= 10 && current.getReading() <= 1000000);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
test/strategy_pattern_tests/RockCoringDrillTest.java
Normal file
74
test/strategy_pattern_tests/RockCoringDrillTest.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.MaterialSample;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.materialsampler.RockCoringDrill;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class RockCoringDrillTest {
|
||||
|
||||
@Test
|
||||
public void validMassTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
RockCoringDrill equipment = new RockCoringDrill(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass());
|
||||
assertTrue(current.getMass() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
RockCoringDrill equipment = new RockCoringDrill(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getDensity());
|
||||
assertTrue(current.getDensity() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctDensityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
RockCoringDrill equipment = new RockCoringDrill(submersible, 0.5);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MaterialSample current = (MaterialSample) data[i];
|
||||
System.out.println(current.getMass() + " " + current.getDensity());
|
||||
assertEquals(current.getMass(),current.getDensity() * 0.5, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
test/strategy_pattern_tests/SalinityTest.java
Normal file
38
test/strategy_pattern_tests/SalinityTest.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.SalinityReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.waterreadings.Salinity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class SalinityTest {
|
||||
|
||||
@Test
|
||||
public void validSalinityTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Salinity equipment = new Salinity(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
SalinityReading current = (SalinityReading) data[i];
|
||||
System.out.println(current.getReading());
|
||||
assertTrue(current.getReading() >= 0 && current.getReading() <= 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
75
test/strategy_pattern_tests/SonarTest.java
Normal file
75
test/strategy_pattern_tests/SonarTest.java
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.SonarReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.topographicalmapper.Sonar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class SonarTest {
|
||||
|
||||
@Test
|
||||
public void validSonarTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Sonar equipment = new Sonar(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
SonarReading current = (SonarReading) data[i];
|
||||
System.out.println(current.getReading());
|
||||
assertTrue(current.getReading() >= 0 && current.getReading() <= 10000);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void correctDepthTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Sonar equipment = new Sonar(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
SonarReading current = (SonarReading) data[i];
|
||||
System.out.println(current.getReading() + " " + current.getDepth());
|
||||
assertEquals(current.getDepth(), current.getReading() * 1.5, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validDepthTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
Sonar equipment = new Sonar(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
SonarReading current = (SonarReading) data[i];
|
||||
System.out.println(current.getDepth());
|
||||
assertTrue(current.getDepth() >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
38
test/strategy_pattern_tests/pHTest.java
Normal file
38
test/strategy_pattern_tests/pHTest.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package strategy_pattern_tests;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import seabedexplorer.data.Data;
|
||||
import seabedexplorer.data.pHReading;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.waterreadings.PH;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Super
|
||||
*/
|
||||
public class pHTest {
|
||||
|
||||
@Test
|
||||
public void validpHTest() {
|
||||
ROV submersible = new ROV();
|
||||
|
||||
PH equipment = new PH(submersible);
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
equipment.collectData();
|
||||
|
||||
Data[] data = equipment.getData().toArray(new Data[100]);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
pHReading current = (pHReading) data[i];
|
||||
System.out.println(current.getReading());
|
||||
assertTrue(current.getReading() >= 1 && current.getReading() <= 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user