Package statechum.analysis.Erlang

Examples of statechum.analysis.Erlang.ErlangModule


    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");
    wr.write("handle_call([67,1900,atom|junk],_,_)->{reply,ok,5};\n");
    wr.write("handle_call([\"str\"],_,_)->{reply,ok,5};\n");
    wr.write("handle_call("+256+",_,_)->{reply,ok,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);

    createLabel("call, 256, ok",config);
    createLabel("call, [\"rrr\"], ok",config);
    createLabel("call, [atom,67,67,1900], ok",config); // proper list
    checkFailureFor("call, 67, ok", config);
View Full Code Here


  {
    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");
    wr.write("handle_call([67,1900,atom|junk],_,_)->{reply,ok,5};\n");
    wr.write("handle_call("+256+",_,_)->{reply,ok,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
   
    createLabel("call, 256, ok",config);
    ErlangLabel.erlangObjectToLabel(ErlangRunner.getRunner().evaluateString("{call, [atom|junk], ok}"),config);
    ErlangLabel.erlangObjectToLabel(ErlangRunner.getRunner().evaluateString("{call, [atom |junk], ok}"),config);
    checkForCorrectException(new whatToRun() { public @Override void run() {
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(\"this is a test\",_,_)->{reply,ok,5};\n");
    wr.write("handle_call(\"more interesting things\",_,_)->{reply,ok,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    createLabel("call, \"ttt\",ok",config);
    createLabel("call, \"ttt\"",config);
    checkFailureFor("call, \"ttt\", \"ttt\"",config);
    checkFailureFor("call, 256, ok",config);
  }
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call({\"this is a test\",\"aa\"},_,_)->{reply,\"yy\",5};\n");
    wr.write("handle_call(\"more interesting things\",_,_)->{reply,ok,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    createLabel("call, \"ttt\",ok",config);
    createLabel("call, \"ttt\",\"y\"",config);
    createLabel("call, {\"ttt\",\"a\"},\"y\"",config);
    createLabel("call, {\"\",\"\"},\"y\"",config);
    createLabel("call, {\"\",\"\"},\"\"",config);
View Full Code Here

    wr.write("handle_call(F,_,_) when F == {4,f} -> {reply,wr(F),5}.\n");
    wr.write("wr({A,B}) -> A+1.");
    //wr.write("handle_call(F,_,_) when F > 0 ->\"yy\".\n");
    //wr.write("handle_call(F,_,_) when F == self() ->\"yy\".\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
   
    createLabel("call, {33,\"a\"},45",config);
    createLabel("call, {33,\"a\"},245",config);
    checkFailureFor("call, {33,\"a\"},a245",config);
    checkFailureFor("call, {a33,\"a\"},245",config);
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(F,_,_) when F == {} -> {reply,wr(F),5}.\n");
    wr.write("wr({}) -> 1.");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    createLabel("call, {},1",config);
    checkFailureFor("call, {44},1",config);
    checkFailureFor("call, {33,\"a\"},a245",config);
    checkFailureFor("call, {a33,\"a\"},245",config);
  }
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(F,_,_) when F == [] -> {reply,wr(F),5}.\n");
    wr.write("wr([]) -> 1.");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    createLabel("call, [],1",config);
    checkFailureFor("call, [44],1",config);
    checkFailureFor("call, [33,\"a\"],a245",config);
    checkFailureFor("call, [a33,\"a\"],245",config);
  }
View Full Code Here

  @Test
  public void testLearningFromErlangTraceFile2() throws IOException
  {
    Configuration config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
    ErlangModule mod = ErlangModule.loadModule(config);
    Set<ErlangLabel> alphabetA = new TreeSet<ErlangLabel>();alphabetA.addAll(mod.behaviour.getAlphabet());
    ErlangModule.flushRegistry();
    config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
    ErlangModule modSame = ErlangModule.loadModule(config);
    Assert.assertTrue(alphabetA.equals(modSame.behaviour.getAlphabet()));// check that the same alphabet will be loaded second time.
    ErlangModule.flushRegistry();
   
    ErlangOracleLearner learner = ErlangQSMOracle.createLearner(null,"resources/earlier_failure2.txt");
    Set<ErlangLabel> alphabetFull = new TreeSet<ErlangLabel>();alphabetFull.addAll(ErlangModule.findModule("locker").behaviour.getAlphabet());
View Full Code Here

  public void testLearningFromErlangTraceFile2() throws IOException
  {
    Configuration config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
        config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule mod = ErlangModule.loadModule(config);
    Set<ErlangLabel> alphabetA = new TreeSet<ErlangLabel>();alphabetA.addAll(mod.behaviour.getAlphabet());
    ErlangModule.flushRegistry();
    config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
    config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule modSame = ErlangModule.loadModule(config);
    Assert.assertTrue(alphabetA.equals(modSame.behaviour.getAlphabet()));// check that the same alphabet will be loaded second time.
    ErlangModule.flushRegistry();
   
    createLogFileFromExistingLog("earlier_failure2.txt");
    ErlangOracleLearner learner = ErlangQSMOracle.createLearner(null,modifiedLogFile);
View Full Code Here

  @Test
  public void testTypeCompatibility1() throws IOException
  {
    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n"+
    "\nhandle_call(45,_,_)->{reply,ok,5}.\n");wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
   
    createLabel("call, 45, ok",config);
    checkFailureFor("call, [45], ok", config);
    checkFailureFor("call, {45}, ok", config);
    checkFailureFor("call, aa, ok", config);
View Full Code Here

TOP

Related Classes of statechum.analysis.Erlang.ErlangModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.