public void EmptyHasNoElements() { PersistentList p = new PersistentList("abc"); IPersistentCollection c = p.empty(); Expect(c.count(), EqualTo(0)); }
public void EmptyReturnsEmptyCollection() { PersistentVector v = PersistentVector.create(1, 2, 3); IPersistentCollection e = v.empty(); Expect(e.count(), EqualTo(0)); }
public void EmptyReturnsEmpty() { Dictionary <int, string> d = new Dictionary <int, string>(); d[1] = "a"; d[2] = "b"; IPersistentMap m = PersistentArrayMap.create(d); IPersistentCollection c = m.empty(); Expect(c.count(), EqualTo(0)); Expect(c.seq(), Null); }
public void Explicit_IPersistentCollection_cons_works() { CPV v = new CPV(new object[] { 1, 2 }); IPersistentCollection c = v as IPersistentCollection; Expect(c, Not.Null); IPersistentCollection c2 = c.cons(3); Expect(c2.count(), EqualTo(3)); ISeq s2 = c2.seq(); Expect(s2.first(), EqualTo(1)); Expect(s2.next().first(), EqualTo(2)); Expect(s2.next().next().first(), EqualTo(3)); Expect(s2.next().next().next(), Null); }
public void Explicit_IPersistentCollection_cons_works() { CPV v = new CPV(new object[] { 1, 2 }); IPersistentCollection c = v as IPersistentCollection; Expect(c).Not.To.Be.Null(); IPersistentCollection c2 = c.cons(3); Expect(c2.count()).To.Equal(3); ISeq s2 = c2.seq(); Expect(s2.first()).To.Equal(1); Expect(s2.next().first()).To.Equal(2); Expect(s2.next().next().first()).To.Equal(3); Expect(s2.next().next().next()).To.Be.Null(); }