package org.scribe.model; import org.junit.Test; import static org.junit.Assert.* ; import Common.Common; import Sequenic.T3.T3Cmd; import Sequenic.T3.T3Random; import Sequenic.T3.Generator.*; import Sequenic.T3.JavaType.JTypeUtils; import Sequenic.T3.Sequence.Datatype.*; import Sequenic.T3.utils.Maybe; import static Sequenic.T3.Generator.Value.ValueMGCombinators.* ; import static Sequenic.T3.Generator.GenCombinators.* ; public class T3TestToken { public static Token gen(int i) { if (i==0) return new Token("abc","abc") ; else return new Token("abc","bca") ; } static public Generator myvalgen = FirstOf( String(OneOf("abc","bca","")), Apply(T3TestToken.class,"gen",OneOf(0,1)) .WithChance(0.5) // .If(hasParamName("o")) --> ideally like this, but can't do this since we have to compile CUT in 1.7 .If(hasClass(Object.class))) ; public static void generate(String CUT,boolean withCustomgen, boolean injectOracle) throws Exception { String cvgOption = "" ; String oracleOption = "" ; if (withCustomgen) cvgOption = " -cvg org.scribe.model.T3TestToken " ; if (!injectOracle) oracleOption =" -norc " ; T3Cmd.main("-reg -core 2 -pl 1 -sl 4 -fup 0 -ms 100 " + cvgOption + oracleOption + " -sd " + Common.getCUTrootBindir() + " -d " + Common.getTrDir() + " " + CUT); } static String CUT = "org.scribe.model.Token" ; @Test public void testPlainWithOracles() throws Throwable { generate(CUT,false,true) ; } @Test public void testWithCustomGenWithOracles() throws Throwable { generate(CUT,true,true) ; } // without injected oracles: //@Test public void testPlain() throws Throwable { generate(CUT,false,false) ; } // without injected oracles: //@Test public void testWithCustomGen() throws Throwable { generate(CUT,true,false) ; } }