Esempio n. 1
0
 /** Method: splitAndConvertIntegers(final String source, int numOfFields) */
 public void testConvertToIntegers05() {
   boolean ok;
   try {
     ok = true;
     String orig = "COUNT[MARSHMALLOWS.1.2.3.4]";
     TermUtilities.convertToIntegers(orig, "1.2.3.4", 6, 3);
   } catch (TermEvaulatorException e) {
     ok = false;
   }
   is(ok, eq(false), "ConvertToIntegers: ask for three with four present fails");
 }
Esempio n. 2
0
 /** Method: splitAndConvertIntegers(final String source, int numOfFields) */
 public void testConvertToIntegers04() {
   boolean ok;
   try {
     ok = true;
     String orig = "COUNT[MARSHMALLOWS.1.2.3.foo]";
     TermUtilities.convertToIntegers(orig, "1.2.3.foo", 6, 4);
   } catch (TermEvaulatorException e) {
     ok = false;
   }
   is(ok, eq(false), "ConvertToIntegers: three ints plus spurious non-int fails");
 }
Esempio n. 3
0
 /** Method: splitAndConvertIntegers(final String source, int numOfFields) */
 public void testConvertToIntegers01() {
   boolean ok;
   int[] nums = new int[1];
   try {
     ok = true;
     String orig = "COUNT[MARSHMALLOWS.1]";
     nums = TermUtilities.convertToIntegers(orig, "1", 6, 1);
   } catch (TermEvaulatorException e) {
     ok = false;
   }
   is(ok, eq(true), "ConvertToIntegers: one int is ok");
   is(nums[0], eq(1), "ConvertToIntegers: one int is ok - first");
 }
Esempio n. 4
0
 /** Method: splitAndConvertIntegers(final String source, int numOfFields) */
 public void testConvertToIntegers02() {
   boolean ok;
   int[] nums = new int[1];
   try {
     ok = true;
     String orig = "COUNT[MARSHMALLOWS.1.2]";
     nums = TermUtilities.convertToIntegers(orig, "1.2", 6, 2);
   } catch (TermEvaulatorException e) {
     ok = false;
   }
   is(ok, eq(true), "ConvertToIntegers: two ints is ok");
   is(nums[0], eq(1), "ConvertToIntegers: two ints is ok:first");
   is(nums[1], eq(2), "ConvertToIntegers: two ints is ok:second");
 }