public void testFitsValue_ListType() { theState.setListType(EnumListType.Range); Assert.IsTrue(theState.fitsValue("a", EnumFitsValue.Allowed), "single values a re ranges too"); Assert.IsFalse(theState.fitsValue("a b", EnumFitsValue.Allowed)); theState.setAllowedValueList(null); Assert.IsTrue(theState.fitsValue("a ~ b", EnumFitsValue.Allowed)); Assert.IsFalse(theState.fitsValue("a b", EnumFitsValue.Allowed)); }
public void testFitsValue() { JDFParser p = new JDFParser(); string strNode = "<NameState Name=\"BitDepth\" DefaultValue=\"1\" AllowedValueList=\"a b c d\"/>"; JDFDoc jdfDoc = p.parseString(strNode); JDFNameState state = (JDFNameState)jdfDoc.getRoot(); VString list = new VString("a b c", null); state.setListType(EnumListType.RangeList); Assert.IsFalse(state.fitsValue(list.ToString(), EnumFitsValue.Allowed), "ListType=RangeList"); VString list2 = new VString(); list2.Add("d"); // 1~-2 }
public virtual void testNameState() { JDFDoc d = new JDFDoc("NameState"); JDFNameState ns = (JDFNameState)d.getRoot(); VString nl = new VString(); nl.Add("anna~berta"); ns.setAllowedValueList(nl); ns.setListType(EnumListType.RangeList); Assert.IsTrue(ns.fitsValue("anna~berta", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); nl.Add("anna~berta hans~otto"); ns.setAllowedValueList(nl); Assert.IsTrue(ns.fitsValue("anna~berta", EnumFitsValue.Allowed)); Assert.IsTrue(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); ns.setAllowedValueList(null); ns.setAllowedRegExp("*"); Assert.IsTrue(ns.fitsValue("hans~otto", EnumFitsValue.Allowed)); ns.setAllowedRegExp("[ab].*"); Assert.IsTrue(ns.fitsValue("al", EnumFitsValue.Allowed)); Assert.IsFalse(ns.fitsValue("cl", EnumFitsValue.Allowed)); }