public void EqualsOnSimilarISeqWorks()
        {
            CPV       v1 = new CPV(new object[] { 'a', 'b', 'c' });
            StringSeq s1 = StringSeq.create("abc");

            Expect(v1.equiv(s1));
        }
Exemplo n.º 2
0
        public void Index_of_rest_is_one()
        {
            StringSeq  s = StringSeq.create("abc");
            IndexedSeq i = (IndexedSeq)s.next();

            Expect(i.index(), EqualTo(1));
        }
Exemplo n.º 3
0
        public void Setup()
        {
            IPersistentMap meta = PersistentHashMap.create("a", 1, "b", 2);

            _s         = StringSeq.create("abcde");
            _sWithMeta = (StringSeq)((IObj)StringSeq.create("abcde")).withMeta(meta);
            _values    = new object[] { 'a', 'b', 'c', 'd', 'e' };
        }
Exemplo n.º 4
0
        public void Setup()
        {
            IPersistentMap meta = new DummyMeta();

            StringSeq s = StringSeq.create("abcde");

            _objWithNullMeta = (IObj)s;
            _obj             = _objWithNullMeta.withMeta(meta);
            _expectedType    = typeof(StringSeq);
        }
        public void EqualsOnDissimilarISeqFails()
        {
            CPV       v1 = new CPV(new object[] { 'a', 'b', 'c' });
            StringSeq s1 = StringSeq.create("ab");
            StringSeq s2 = StringSeq.create("abd");
            StringSeq s3 = StringSeq.create("abcd");

            Expect(v1.equiv(s1), False);
            Expect(v1.equiv(s2), False);
            Expect(v1.equiv(s3), False);
        }
Exemplo n.º 6
0
        public void Setup()
        {
            _mocks = new MockRepository();
            IPersistentMap meta = _mocks.StrictMock <IPersistentMap>();

            _mocks.ReplayAll();

            StringSeq s = StringSeq.create("abcde");


            _objWithNullMeta = (IObj)s;
            _obj             = _objWithNullMeta.withMeta(meta);
            _expectedType    = typeof(StringSeq);
        }
Exemplo n.º 7
0
        static object StringSeqReduce(StringSeq strSeq, object f, object val)
        {
            var s   = strSeq.S;
            var len = s.Length;

            return(loop(strSeq.I, val));

            object loop(int i, object v)
            {
                if (i < len)
                {
                    var ret = funclib.Core.Invoke(f, v, s[i]);
                    if (ret is Reduced r)
                    {
                        return(r.Deref());
                    }
                    return(loop((int)funclib.Core.Inc(i), ret));
                }
                return(v);
            }
        }
Exemplo n.º 8
0
        public void Initial_index_is_zero()
        {
            StringSeq s = StringSeq.create("abc");

            Expect(s.index(), EqualTo(0));
        }
Exemplo n.º 9
0
        public void Count_is_string_length()
        {
            StringSeq s = StringSeq.create("abcde");

            Expect(s.count(), EqualTo(5));
        }
Exemplo n.º 10
0
        public void Create_on_nonempty_string_yields_a_StringSeq()
        {
            StringSeq s = StringSeq.create("abcde");

            Expect(s, Not.Null);
        }
Exemplo n.º 11
0
        public void Create_on_empty_string_yields_null()
        {
            StringSeq s = StringSeq.create(String.Empty);

            Expect(s, Null);
        }