Skip to content

Commit

Permalink
kill more ref to JExample
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Oct 23, 2024
1 parent f9e05e7 commit d3b2b69
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions lib/src/test/java/ch/akuhn/fame/test/ArrayFieldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.junit.runner.RunWith;

import ch.akuhn.fame.FameDescription;
import ch.akuhn.fame.FamePackage;
import ch.akuhn.fame.FameProperty;
import ch.akuhn.fame.Tower;
import ch.akuhn.fame.fm3.MetaDescription;
import ch.akuhn.fame.fm3.PropertyDescription;
import ch.unibe.jexample.Given;
import ch.unibe.jexample.Injection;
import ch.unibe.jexample.InjectionPolicy;
import ch.unibe.jexample.JExample;


@FamePackage("Test")
@RunWith(JExample.class)
@Injection(InjectionPolicy.NONE)
public class ArrayFieldTest {

@FameDescription
Expand All @@ -30,7 +22,7 @@ private static class Dummy {
}

@Test
public Tower metamodel() {
public void metamodel() {
Tower t = new Tower();
t.metamodel.with(Dummy.class);
assertEquals(1, t.metamodel.allClassDescriptions().size());
Expand All @@ -39,27 +31,34 @@ public Tower metamodel() {
assertEquals(true, prop.isMultivalued());
assertEquals(true, prop.isPrimitive());
assertEquals(MetaDescription.NUMBER, prop.getType());
return t;
}

@Test
@Given("#metamodel")
public String exportModel(Tower t) {
public void exportModel() {
Tower t = new Tower();
t.metamodel.with(Dummy.class);
assertEquals(0, t.model.size());
Dummy d = new Dummy();
d.array = new float[] { 0.5f, 1.0f, 2.75f };
t.model.add(d);
assertEquals(1, t.model.size());
String mse = t.model.exportMSE();
assertTrue(mse.contains("(array 0.5 1.0 2.75)"));
return mse;
}

@Test
@Given("#exportModel")
public void importModel(String mse) {
public void importModel() {
// Init
Tower t = new Tower();
t.metamodel.with(Dummy.class);
Dummy d = new Dummy();
d.array = new float[] { 0.5f, 1.0f, 2.75f };
t.model.add(d);
String mse = t.model.exportMSE();

// Tests
t = new Tower();
t.metamodel.with(Dummy.class);
assertEquals(0, t.model.size());
t.model.importMSE(mse);
assertEquals(1, t.model.size());
Expand Down

0 comments on commit d3b2b69

Please sign in to comment.