Package edu.cmu.cs.fusion.constraint.predicates

Examples of edu.cmu.cs.fusion.constraint.predicates.BooleanValue


  }
 
  @Test
  public void testFreeVars() {
    FreeVars fv;
    Predicate bPred = new BooleanValue(utils.getVar(0));
   
    fv = bPred.getFreeVariables();
    assertEquals(1, fv.size());
    assertEquals(fv.getType(utils.getVar(0)), FreeVars.BOOL_TYPE);
  }
View Full Code Here


    assertEquals(fv.getType(utils.getVar(0)), FreeVars.BOOL_TYPE);
  }
 
  @Test
  public void testTruthFalse() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.FALSE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthTrue() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.TRUE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthUnknown() {
    Predicate bv = new BooleanValue(utils.getVar(0));
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.UNKNOWN);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.UNKNOWN, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.UNKNOWN, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotFalse() {
    BooleanValue bv = new BooleanValue(utils.getVar(0));
    bv.setPositive(false);
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.FALSE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.TRUE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotTrue() {
    BooleanValue bv = new BooleanValue(utils.getVar(0));
    bv.setPositive(false);
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.TRUE);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    assertEquals(ThreeValue.FALSE, bv.getTruth(env, utils.getSub(0)));
  }

  @Test
  public void testTruthNotUnknown() {
    BooleanValue bv = new BooleanValue(utils.getVar(0));
    bv.setPositive(false);
    Map<ObjectLabel, ThreeValue> tvs = new HashMap<ObjectLabel, ThreeValue>();
    tvs.put(utils.getSub(0).getSub(utils.getVar(0)), ThreeValue.UNKNOWN);
    FusionEnvironment env = new TestEnvironment(utils.getContext(0), tvs, Variant.SOUND_VARIANT);
   
    assertEquals(ThreeValue.UNKNOWN, bv.getTruth(env, utils.getSub(0)));
  }
View Full Code Here

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be positive", val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain one free variable", 1, vars.size());
    Assert.assertEquals("Foo should have a boolean type", "boolean", vars.getType(new SpecVar("foo")));
  }
View Full Code Here

    FPLParser parser = new FPLParser(string, null, null);
    Predicate pred = parser.expression();
   
    Assert.assertTrue("Parsed predicate should be a BooleanValue, but is " + pred.getClass().getCanonicalName(), pred instanceof BooleanValue);
   
    BooleanValue val = (BooleanValue)pred;
    Assert.assertTrue("Parsed predicate should be negative", !val.isPositive());
   
    FreeVars vars = val.getFreeVariables();
    Assert.assertEquals("Should only contain one free variable", 1, vars.size());
    Assert.assertEquals("Foo should have a boolean type", "boolean", vars.getType(new SpecVar("foo")));
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.predicates.BooleanValue

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.