Beispiel #1
0
 @Parameters(name = "{0} : {1}")
 public static List<Object[]> configurations() {
   List<Object[]> params = new LinkedList<>();
   for (Object[] choice : ChoiceFactory.asParameter()) {
     params.add(new Object[] {choice[0], FeatureExprFactory.bdd()});
     params.add(new Object[] {choice[0], FeatureExprFactory.sat()});
   }
   return params;
 }
Beispiel #2
0
 @Test
 public void testMapf3() {
   Conditional<Integer> v1 = One(1);
   v1 =
       v1.mapf(
           fa,
           new BiFunction<FeatureExpr, Integer, Conditional<Integer>>() {
             @Override
             public Conditional<Integer> apply(FeatureExpr c, Integer x) {
               return Choice(fa, One(2), One(x));
             }
           });
   System.out.println(v1);
   v1 =
       v1.mapf(
           FeatureExprFactory.True(),
           new BiFunction<FeatureExpr, Integer, Conditional<Integer>>() {
             @Override
             public Conditional<Integer> apply(FeatureExpr c, Integer x) {
               return Choice(c.and(fb), One(3), One(x));
             }
           });
   System.out.println(v1);
   assertEquals(
       Choice(fa, Choice((fa.and(fb)), One(3), One(2)), Choice(fb.andNot(fa), One(3), One(1))),
       v1);
 }
Beispiel #3
0
  public ConditionalTest(Factory factory, AbstractFeatureExprFactory fexprFeactory) {
    ChoiceFactory.setDefault(factory);
    FeatureExprFactory.setDefault(fexprFeactory);

    fa = FeatureExprFactory.createDefinedExternal("A");
    fb = FeatureExprFactory.createDefinedExternal("B");
    fc = FeatureExprFactory.createDefinedExternal("C");
    fd = FeatureExprFactory.createDefinedExternal("D");
    fe = FeatureExprFactory.createDefinedExternal("E");
    ff = FeatureExprFactory.createDefinedExternal("F");
    fg = FeatureExprFactory.createDefinedExternal("G");
  }
Beispiel #4
0
  @SuppressWarnings("unchecked")
  public StackHandler(FeatureExpr ctx, int nLocals, int nOperands) {
    if (ctx == null) {
      // if loading class inside jetty, the ctx is null
      System.err.println("CAUTIOUS! CTX == NULL, creating True");
      ctx = FeatureExprFactory.True();
      //      throw new RuntimeException("CTX == NULL");
    }
    length = nLocals + nOperands;
    locals = new Conditional[nLocals];
    Arrays.fill(locals, nullValue);

    // stack = new One<>(new Stack(nOperands));
    stack = StackFactory.createVStack(nOperands);
    stack.setCtx(ctx);
  }
Beispiel #5
0
 public static FeatureExpr True() {
   return FeatureExprFactory.True();
 }
Beispiel #6
0
 @SuppressWarnings("unchecked")
 public StackHandler() {
   locals = new Conditional[0];
   stack = StackFactory.createVStack();
   stack.setCtx(FeatureExprFactory.True());
 }
Beispiel #7
0
 /* (non-Javadoc)
  * @see gov.nasa.jpf.vm.IStackHandler#getSlots()
  */
 @Override
 public int[] getSlots() {
   return getSlots(FeatureExprFactory.True());
 }
Beispiel #8
0
 @Override
 public FeatureExpr when(Predicate<T> condition) {
   return condition.test(value) ? FeatureExprFactory.True() : FeatureExprFactory.False();
 }
Beispiel #9
0
 @Override
 public FeatureExpr when(@Nonnull Predicate<T> condition) {
   assert condition != null;
   return condition.test(value) ? FeatureExprFactory.True() : FeatureExprFactory.False();
 }