public void testAddValue() { JDFNumberRangeList integerList = new JDFNumberRangeList("1 2 3 4 ~ 44"); iState.setAllowedValueList(integerList); iState.addValue("24", EnumFitsValue.Allowed); Assert.AreEqual(integerList, iState.getAllowedValueList()); iState.addValue("45", EnumFitsValue.Allowed); Assert.AreEqual(new JDFNumberRangeList("1 2 3 4 ~ 44 45"), iState.getAllowedValueList()); iState.addValue("48", EnumFitsValue.Present); Assert.AreEqual(new JDFNumberRangeList("48"), iState.getPresentValueList()); }
public virtual void testNumberState() { JDFDoc d = new JDFDoc("NumberState"); JDFNumberState ns = (JDFNumberState)d.getRoot(); JDFNumberRangeList nrl = new JDFNumberRangeList("12.45~15.88"); ns.setAllowedValueList(nrl); ns.setListType(EnumListType.RangeList); Assert.IsTrue(ns.fitsValue("12.45~15.88", EnumFitsValue.Allowed)); Assert.IsTrue(ns.fitsValue("12.45~13.0", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("19.0~33.234", EnumFitsValue.Allowed)); nrl = new JDFNumberRangeList("12.45~15.88 19.0~33.234"); ns.setAllowedValueList(nrl); Assert.IsTrue(ns.fitsValue("12.45", EnumFitsValue.Allowed)); Assert.IsTrue(ns.fitsValue("19.0~33.234", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("16.01", EnumFitsValue.Allowed)); }
public void testFitsValue() { JDFParser p = new JDFParser(); string strNode = "<NumberState Name=\"BitDepth\" DefaultValue=\"1\" AllowedValueList=\"1 8.5 12\"/>"; JDFDoc jdfDoc = p.parseString(strNode); JDFNumberState state = (JDFNumberState)jdfDoc.getRoot(); JDFNumberRangeList list = new JDFNumberRangeList(); list.Append(new JDFNumberRange(1, 12.5)); // 1~12 // list.append(12); state.setListType(EnumListType.RangeList); Assert.IsFalse(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=RangeList"); JDFNumberRangeList list2 = new JDFNumberRangeList(); list2.Append(new JDFNumberRange(1, 12.5)); // 1~-2 JDFNumberRangeList allowedVL = new JDFNumberRangeList(); allowedVL.Append(new JDFNumberRange(1, 32.666)); // 1~32 state.setAllowedValueList(allowedVL); // new AllowedVlaueList Assert.IsTrue(state.fitsValue(list2.ToString(), EnumFitsValue.Allowed)); list.erase(list.Count - 1); // erase "1~12" list.Append(2); list.Append(12); list.Append(22); state.setListType(EnumListType.List); state.setAllowedValueMod(new JDFXYPair(10, 2)); Assert.IsTrue(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=List, ValueMod=" + state.getAllowedValueMod()); }