Commit 9d0ed96a authored by Julian Treiber's avatar Julian Treiber

added weights path tests

parent 32e96d15
Pipeline #267264 passed with stage
in 1 minute and 30 seconds
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.cnnarch.generator;
import de.monticore.lang.monticar.cnnarch._symboltable.*;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class WeightsPathConfigParserTest extends AbstractSymtabTest {
@Before
public void setUp() {
// ensure an empty log
Log.getFindings().clear();
Log.enableFailQuick(false);
}
@Test
public void testWeightsPathConfigParserValidComponent() {
WeightsPathConfigParser parser = new WeightsPathConfigParser("src/test/resources/architectures/weights_paths.txt");
String weights_path = parser.getWeightsPath("ComponentName");
assertTrue("Wrong weights path returned", weights_path.equals("/path/to/training/weights"));
}
@Test
public void testWeightsPathConfigParserInvalidComponent() {
WeightsPathConfigParser parser = new WeightsPathConfigParser("src/test/resources/architectures/weights_paths.txt");
String weights_path = parser.getWeightsPath("NotExistingComponent");
assertTrue("For not listed components, null should be returned", weights_path == null);
assertTrue(Log.getFindings().size() == 1);
}
@Test
public void testWeightsPathConfigParserInvalidPath() {
WeightsPathConfigParser parser = new WeightsPathConfigParser("invalid/path/weights_paths.txt");
assertTrue(Log.getFindings().size() == 1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment