public void ConsWorks() { MapEntry me = new MapEntry(1, "abc"); IPersistentVector v1 = me.cons(2); Expect(me.count(), EqualTo(2)); Expect(me.key(), EqualTo(1)); Expect(me.val(), EqualTo("abc")); Expect(v1.count(), EqualTo(3)); Expect(v1.nth(0), EqualTo(1)); Expect(v1.nth(1), EqualTo("abc")); Expect(v1.nth(2), EqualTo(2)); }
public void AssocNInRangeModifies() { MapEntry me = new MapEntry(1, "abc"); IPersistentVector v1 = me.assocN(0, 2); IPersistentVector v2 = me.assocN(1, "def"); IPersistentVector v3 = me.assocN(2, "ghi"); Expect(me.count(), EqualTo(2)); Expect(me.key(), EqualTo(1)); Expect(me.val(), EqualTo("abc")); Expect(v1.count(), EqualTo(2)); Expect(v1.nth(0), EqualTo(2)); Expect(v1.nth(1), EqualTo("abc")); Expect(v2.count(), EqualTo(2)); Expect(v2.nth(0), EqualTo(1)); Expect(v2.nth(1), EqualTo("def")); Expect(v3.count(), EqualTo(3)); Expect(v3.nth(0), EqualTo(1)); Expect(v3.nth(1), EqualTo("abc")); Expect(v3.nth(2), EqualTo("ghi")); }
public void PeekReturnsVal() { MapEntry me = new MapEntry(1, "abc"); Expect(me.peek(), EqualTo("abc")); Expect(me.count(), EqualTo(2)); Expect(me.key(), EqualTo(1)); Expect(me.val(), EqualTo("abc")); }
public void ExplictIPersistentCollectionConsWorks() { MapEntry me = new MapEntry(1, "abc"); IPersistentCollection c = (IPersistentCollection)me; ISeq s = c.cons(2).seq(); Expect(me.count(), EqualTo(2)); Expect(me.key(), EqualTo(1)); Expect(me.val(), EqualTo("abc")); Expect(s.count(), EqualTo(3)); Expect(s.first(), EqualTo(1)); Expect(s.next().first(), EqualTo("abc")); Expect(s.next().next().first(), EqualTo(2)); Expect(s.next().next().next(), Null); }
public void CountIs2() { MapEntry me = new MapEntry(1, "abc"); Expect(me.count(), EqualTo(2)); }