Exemple #1
0
        public void CreateOnNoArgsReturnsEmptySet()
        {
            PersistentHashSet m = PersistentHashSet.create();

            Expect(m.count(), EqualTo(0));
            Expect(m.meta(), Null);
        }
Exemple #2
0
        public void DoBigTest(int numEntries)
        {
            System.Console.WriteLine("Testing {0} items.", numEntries);

            Random rnd = new Random();
            Dictionary <object, object> dict = new Dictionary <object, object>(numEntries);

            for (int i = 0; i < numEntries; i++)
            {
                int r = rnd.Next();
                dict[r] = r;
            }

            object[] items = dict.Keys.ToArray();

            PersistentHashSet m = (PersistentHashSet)PersistentHashSet.create(items);

            Expect(m.count(), EqualTo(dict.Count));

            foreach (int key in dict.Keys)
            {
                Expect(m.contains(key));
            }

            for (ISeq s = m.seq(); s != null; s = s.next())
            {
                Expect(dict.ContainsKey((int)s.first()));
            }
        }
        public void CreateOnNoArgsReturnsEmptySet()
        {
            PersistentHashSet m = PersistentHashSet.create();

            Expect(m.count()).To.Equal(0);
            Expect(m.meta()).To.Be.Null();
        }
Exemple #4
0
        public void CreateOnEmptyISeqReturnsEmptySet()
        {
            object[]       items = new object[] { };
            ArrayList      a     = new ArrayList(items);
            ISeq           s     = PersistentList.create(a).seq();
            IPersistentSet m     = PersistentHashSet.create(s);

            Expect(m.count(), EqualTo(0));
        }
Exemple #5
0
        public void CreateOnNoArgsReturnsSet()
        {
            PersistentHashSet m = PersistentHashSet.create(1, "a");

            Expect(m.count(), EqualTo(2));
            Expect(m.contains(1));
            Expect(m.contains("a"));
            Expect(m.contains(3), False);
            Expect(m.meta(), Null);
        }
        public void CreateOnNoArgsReturnsSet()
        {
            PersistentHashSet m = PersistentHashSet.create(1, "a");

            Expect(m.count()).To.Equal(2);
            Expect(m.contains(1));
            Expect(m.contains("a"));
            Expect(m.contains(3)).To.Be.False();
            Expect(m.meta()).To.Be.Null();
        }
Exemple #7
0
        public void Setup()
        {
            IPersistentMap meta = new DummyMeta();

            PersistentHashSet m = PersistentHashSet.create(1, "a", 2, "b");


            _objWithNullMeta = (IObj)m;
            _obj             = _objWithNullMeta.withMeta(meta);
            _expectedType    = typeof(PersistentHashSet);
        }
Exemple #8
0
        public void CreateOnISeqReturnsSet()
        {
            object[]       items = new object[] { 1, "a" };
            ArrayList      a     = new ArrayList(items);
            ISeq           s     = PersistentList.create(a).seq();
            IPersistentSet m     = PersistentHashSet.create(s);

            Expect(m.count(), EqualTo(2));
            Expect(m.contains(1));
            Expect(m.contains("a"));
            Expect(m.contains(3), False);
        }
        public void Setup()
        {
            _mocks = new MockRepository();
            IPersistentMap meta = _mocks.StrictMock <IPersistentMap>();

            _mocks.ReplayAll();

            PersistentHashSet m = PersistentHashSet.create(1, "a", 2, "b");


            _objWithNullMeta = (IObj)m;
            _obj             = _objWithNullMeta.withMeta(meta);
            _expectedType    = typeof(PersistentHashSet);
        }