Skip to content
Snippets Groups Projects
Commit ae7810dd authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

added config files

parent 0f13cbd8
No related branches found
No related tags found
No related merge requests found
plugins { plugins {
id "java" id 'application'
} }
apply plugin : "java"
group 'L3_INFO' group 'L3_INFO'
version '1.0-SNAPSHOT' version '1.0-SNAPSHOT'
...@@ -19,3 +21,7 @@ test { ...@@ -19,3 +21,7 @@ test {
useJUnitPlatform() useJUnitPlatform()
} }
application {
mainClass = 'curve.App'
}
org.gradle.warning.mode=all
\ No newline at end of file
...@@ -21,6 +21,7 @@ public class App { ...@@ -21,6 +21,7 @@ public class App {
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
String[] arguments = {"gnuplot", "-persist"}; String[] arguments = {"gnuplot", "-persist"};
Process process = runtime.exec(arguments); Process process = runtime.exec(arguments);
Writer stream = new OutputStreamWriter(process.getOutputStream()); Writer stream = new OutputStreamWriter(process.getOutputStream());
writeGnuplotInput(stream, curve); writeGnuplotInput(stream, curve);
} }
......
package curve; package curve;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.*;
import formula.Sum; import formula.Sum;
import formula.Variable; import formula.Variable;
...@@ -15,7 +14,7 @@ import formula.Variable; ...@@ -15,7 +14,7 @@ import formula.Variable;
public class CurveTest { public class CurveTest {
@Test @Test
public void test() throws IOException { void test() throws IOException {
Variable variable = new Variable("variable", 0); Variable variable = new Variable("variable", 0);
Function function = new Function(new Sum(variable, variable), variable); Function function = new Function(new Sum(variable, variable), variable);
double startValue = -1; double startValue = -1;
...@@ -28,10 +27,10 @@ public class CurveTest { ...@@ -28,10 +27,10 @@ public class CurveTest {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (double value = startValue; value <= endValue; value += step) { for (double value = startValue; value <= endValue; value += step) {
stringBuilder.append(value+" "+2*value+"\n"); stringBuilder.append(value).append(" ").append(2 * value).append("\n");
} }
assertThat(writer.toString(), equalTo(stringBuilder.toString())); assertThat(writer.toString()).isEqualTo(stringBuilder.toString());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment