Package test.list.types

Examples of test.list.types.Separated


    ATerm pattern =
      factory.getPureFactory().parse(
        "[\"m1\",l(\"l1\"),\"sep\",l(\"l2\"),\"m2\",l(\"l3\"),\"sep\",l(\"l4\"),\"m3\",l(\"l5\"),\"sep\",l(\"l6\"),\"m4\"]");

    Separated sep = factory.SeparatedFromTerm(pattern);
    testAssert(sep.toTerm().isEqual(pattern), " fromTerm == toTerm separated lists");

    ATerm patternReversed =
      factory.getPureFactory().parse(
        "[\"m4\",l(\"l5\"),\"sep\",l(\"l6\"),\"m3\",l(\"l3\"),\"sep\",l(\"l4\"),\"m2\",l(\"l1\"),\"sep\",l(\"l2\"),\"m1\"]");
    Separated sepReversed = factory.SeparatedFromTerm(patternReversed);
    testAssert(sep.reverse().isEqual(sepReversed), " separated reverse test");
    testAssert(sep.reverseSeparated().toTerm().isEqual(patternReversed), "separated reverse toTerm test");

    Module head = sep.getHead();
View Full Code Here


    for (int i = 0; i < 6; i++) {
      m[i] = factory.makeModule_Default("m" + i);
    }
    Layout l = factory.makeLayout_Default("l");

    Separated list[] = new Separated[7];

    list[0] = factory.makeSeparated();
    list[1] = factory.makeSeparated(m[0]);
    list[2] = factory.makeSeparated(l, l, m[0], m[1]);
    list[3] = factory.makeSeparated(l, l, m[0], m[1], m[2]);
View Full Code Here

      testAssert(list[i].getLength() == i, "" + i + " element list");
    }
  }

  private void testSeparatedElementAt() {
    Separated triple =
      factory.SeparatedFromString("[\"m0\",l(\" \"),\"sep\",l(\" \"),\"m1\",l(\" \"),\"sep\",l(\" \"),\"m2\"]");

    for (int i = 0; i < 3; i++) {
      Module m = (Module) triple.elementAt(i);
      Module ref = factory.makeModule_Default("m" + i);
      testAssert(m.isEqual(ref), "elementAt " + i);

      m = triple.getModuleAt(i);
      testAssert(m.isEqual(ref), "getModuleAt " + i);
    }
  }
View Full Code Here

      testAssert(m.isEqual(ref), "getModuleAt " + i);
    }
  }

  private void testSeparatedAppend() {
    Separated empty = factory.makeSeparated();
    Module m = factory.makeModule_Default("m");
    Layout l = factory.makeLayout_Default(" ");
    Separated single = empty.append(l, l, m);

    testAssert(single.isEqual(factory.SeparatedFromString("[\"m\"]")), "test append on empty list");

    Separated twin = single.append(l, l, m);
    testAssert(
      twin.isEqual(factory.SeparatedFromString("[\"m\",l(\" \"),\"sep\",l(\" \"),\"m\"]")),
      "append on singleton");
  }
View Full Code Here

TOP

Related Classes of test.list.types.Separated

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.