aboutsummaryrefslogtreecommitdiff
path: root/ClojureCLR/Clojure/Clojure.Tests/LibTests
diff options
context:
space:
mode:
authorDavid Miller <dmiller2718@gmail.com>2009-05-31 07:30:14 +0000
committerDavid Miller <dmiller2718@gmail.com>2009-05-31 07:30:14 +0000
commit7eabf5df39ab6bb0e93a53a8ddc1651d49d9ff3e (patch)
tree3f2008c4368545d78a38ba9fe82e92c91cc5baeb /ClojureCLR/Clojure/Clojure.Tests/LibTests
parent9dbcb6b2922f9e337621811133a0e53e8561f753 (diff)
ClojureCLR: major update
Diffstat (limited to 'ClojureCLR/Clojure/Clojure.Tests/LibTests')
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs42
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs5
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs120
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs12
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs123
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs332
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/MapEntryTests.cs14
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/NumbersTests.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentArrayMapTests.cs4
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashMapTests.cs6
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentHashSetTests.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentListTests.cs10
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/PersistentTreeMapTests.cs2
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamSeqTests.cs22
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/StringSeqTests.cs2
15 files changed, 237 insertions, 463 deletions
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
index 88213a02..a8be1ab2 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/APersistentVectorTests.cs
@@ -283,9 +283,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.first(), EqualTo(1));
- Expect(s.rest().first(), EqualTo(2));
- Expect(s.rest().rest().first(), EqualTo(3));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(2));
+ Expect(s.next().next().first(), EqualTo(3));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -302,9 +302,9 @@ namespace Clojure.Tests.LibTests
ISeq s2 = c2.seq();
Expect(s2.first(), EqualTo(1));
- Expect(s2.rest().first(), EqualTo(2));
- Expect(s2.rest().rest().first(), EqualTo(3));
- Expect(s2.rest().rest().rest(), Null);
+ Expect(s2.next().first(), EqualTo(2));
+ Expect(s2.next().next().first(), EqualTo(3));
+ Expect(s2.next().next().next(), Null);
}
#endregion
@@ -334,9 +334,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.first(), EqualTo(3));
- Expect(s.rest().first(), EqualTo(2));
- Expect(s.rest().rest().first(), EqualTo(1));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(2));
+ Expect(s.next().next().first(), EqualTo(1));
+ Expect(s.next().next().next(), Null);
}
@@ -528,9 +528,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.first(), EqualTo(4));
- Expect(s.rest().first(), EqualTo(5));
- Expect(s.rest().rest().first(), EqualTo(6));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(5));
+ Expect(s.next().next().first(), EqualTo(6));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -540,7 +540,7 @@ namespace Clojure.Tests.LibTests
ISeq s0 = v.seq();
IndexedSeq i0 = s0 as IndexedSeq;
- ISeq s1 = s0.rest();
+ ISeq s1 = s0.next();
IndexedSeq i1 = s1 as IndexedSeq;
Expect(i0.index(), EqualTo(0));
@@ -554,8 +554,8 @@ namespace Clojure.Tests.LibTests
ISeq s = v.seq();
Expect(s.count(), EqualTo(3));
- Expect(s.rest().count(), EqualTo(2));
- Expect(s.rest().rest().count(), EqualTo(1));
+ Expect(s.next().count(), EqualTo(2));
+ Expect(s.next().next().count(), EqualTo(1));
}
[Test]
@@ -621,9 +621,9 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.first(), EqualTo(6));
- Expect(s.rest().first(), EqualTo(5));
- Expect(s.rest().rest().first(), EqualTo(4));
- Expect(s.rest().rest().rest(), Null);
+ Expect(s.next().first(), EqualTo(5));
+ Expect(s.next().next().first(), EqualTo(4));
+ Expect(s.next().next().next(), Null);
}
[Test]
@@ -633,7 +633,7 @@ namespace Clojure.Tests.LibTests
ISeq s0 = v.rseq();
IndexedSeq i0 = s0 as IndexedSeq;
- ISeq s1 = s0.rest();
+ ISeq s1 = s0.next();
IndexedSeq i1 = s1 as IndexedSeq;
Expect(i0.index(), EqualTo(0));
@@ -647,8 +647,8 @@ namespace Clojure.Tests.LibTests
ISeq s = v.rseq();
Expect(s.count(), EqualTo(3));
- Expect(s.rest().count(), EqualTo(2));
- Expect(s.rest().rest().count(), EqualTo(1));
+ Expect(s.next().count(), EqualTo(2));
+ Expect(s.next().next().count(), EqualTo(1));
}
[Test]
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
index b01e1786..1b0de513 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ConsTests.cs
@@ -80,7 +80,8 @@ namespace Clojure.Tests.LibTests
{
// Test of ASeq
Cons c = new Cons("abc", null);
- Expect(c.empty(), Null);
+ IPersistentCollection empty = c.empty();
+ Expect(empty, SameAs(PersistentList.EMPTY));
}
[Test]
@@ -93,7 +94,7 @@ namespace Clojure.Tests.LibTests
ISeq s = ipc2.seq();
Expect(s.first(), EqualTo("def"));
- Expect(s.rest(), SameAs(c1));
+ Expect(s.next(), SameAs(c1));
}
#endregion
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs
deleted file mode 100644
index 93d64773..00000000
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/FnSeqTests.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-using Rhino.Mocks;
-
-using clojure.lang;
-
-using RMExpect = Rhino.Mocks.Expect;
-
-namespace Clojure.Tests.LibTests
-{
- [TestFixture]
- public class FnSeqTests : AssertionHelper
- {
- #region C-tor tests
-
- // Couldn't think of anything except to make sure it doesn't throw an exception.
- [Test]
- public void CtorWorks()
- {
- FnSeq fs = new FnSeq("abc",null);
-
- Expect(fs, Not.Null);
- }
-
- #endregion
- }
-
- [TestFixture]
- public class FnSeq_ISeq_Tests : ISeqTestHelper
- {
- object[] _restValues;
- object[] _values;
- MockRepository _mocks;
- FnSeq _fs;
-
- [SetUp]
- public void Setup()
- {
- _restValues = new object[] { 2, 3, 4 };
- _values = new object[] { "abc", 2, 3, 4 };
- _mocks = new MockRepository();
- IFn _fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(_fn.invoke()).Return(PersistentList.create(_restValues));
-
- _fs = new FnSeq("abc", _fn);
-
- _mocks.ReplayAll();
- }
-
- [TearDown]
- public void Teardown()
- {
- _mocks.VerifyAll();
- }
-
-
- [Test]
- public void FnSeq_ISeq_has_correct_values()
- {
- VerifyISeqContents(_fs, _values);
- }
-
- [Test]
- public void FnSeq_ISeq_conses()
- {
- VerifyISeqCons(_fs, 12, _values);
- }
-
- [Test]
- public void RestCachesResult()
- {
- _fs.rest();
- _fs.rest();
- }
-
-
-
- }
-
- [TestFixture]
- public class FnSeq_IObj_Tests : IObjTests
- {
- MockRepository _mocks;
-
- [SetUp]
- public void Setup()
- {
- _mocks = new MockRepository();
- IFn fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(fn.invoke()).Return(null);
- _mocks.ReplayAll();
-
- FnSeq fs = new FnSeq("abc", fn);
-
- _obj = _objWithNullMeta = fs;
- _expectedType = typeof(FnSeq);
- }
-
- [TearDown]
- public void TearDown()
- {
- _mocks.ReplayAll();
- }
-
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
index ba04a65e..238afb0c 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/ISeqTestHelper.cs
@@ -23,7 +23,7 @@ namespace Clojure.Tests.LibTests
{
int i=0;
- for (; s != null; s = s.rest(), i++)
+ for (; s != null; s = s.next(), i++)
Expect(s.first(), EqualTo(values[i]));
Expect(i, EqualTo(values.Count));
@@ -34,21 +34,21 @@ namespace Clojure.Tests.LibTests
ISeq newSeq = s.cons(newVal);
Expect(newSeq.first(), EqualTo(newVal));
- VerifyISeqContents(newSeq.rest(), values);
+ VerifyISeqContents(newSeq.next(), values);
}
public void VerifyISeqRestTypes(ISeq s, Type type)
{
- for ( ; s.rest() != null; s = s.rest())
- Expect(s.rest(), InstanceOfType(type));
+ for ( ; s.next() != null; s = s.next())
+ Expect(s.next(), InstanceOfType(type));
}
public void VerifyISeqRestMaintainsMeta(ISeq s)
{
IPersistentMap meta = ((IMeta)s).meta();
- for (; s.rest() != null; s = s.rest())
- Expect(((IMeta)s.rest()).meta(), EqualTo(meta));
+ for (; s.next() != null; s = s.next())
+ Expect(((IMeta)s.next()).meta(), EqualTo(meta));
}
}
}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs
deleted file mode 100644
index 0a230c0e..00000000
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LazyConsTests.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (c) David Miller. All rights reserved.
- * The use and distribution terms for this software are covered by the
- * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
- * which can be found in the file epl-v10.html at the root of this distribution.
- * By using this software in any fashion, you are agreeing to be bound by
- * the terms of this license.
- * You must not remove this notice, or any other, from this software.
- **/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-using NUnit.Framework;
-using Rhino.Mocks;
-
-using clojure.lang;
-
-using RMExpect = Rhino.Mocks.Expect;
-
-
-namespace Clojure.Tests.LibTests
-{
- [TestFixture]
- public class LazyConsTests : AssertionHelper
- {
-
- #region C-tor tests
-
- // Couldn't think of anything except to make sure it doesn't throw an exception.
- [Test]
- public void CtorWorks()
- {
- LazyCons lc = new LazyCons(null);
-
- Expect(lc, Not.Null);
- }
-
- #endregion
- }
-
- [TestFixture]
- public class LazyCons_ISeq_Tests : ISeqTestHelper
- {
- MockRepository _mocks ;
- IFn _fn;
- LazyCons _lc;
- object[] _values;
-
- [SetUp]
- public void Setup()
- {
- _mocks = new MockRepository();
- _fn = _mocks.StrictMock<IFn>();
- RMExpect.Call(_fn.invoke()).Return(10);
- RMExpect.Call(_fn.invoke(null)).Return(new Cons(20,null));
- _lc = new LazyCons(_fn);
- _values = new object[] { 10, 20 };
- _mocks.ReplayAll();
- }
-
- [TearDown]
- public void Teardown()
- {
- _mocks.VerifyAll();
- }
-
- [Test]
- public void ISeq_has_proper_values()
- {
- VerifyISeqContents(_lc, _values);
- }
-
- [Test]
- public void First_caches()
- {
- _lc.first();
- _lc.first();
-
- // Need to meet expectation that _rest is called.
- _lc.rest();
- }
-
- [Test]
- public void Rest_calcs_first()
- {
- _lc.rest();
- }
-
- [Test]
- public void Rest_caches()
- {
- _lc.rest();
- _lc.rest();
- }
-
-
-
- }
-
- [TestFixture]
- public class LazyCons_IObj_Tests : IObjTests
- {
- [SetUp]
- public void Setup()
- {
- MockRepository mocks = new MockRepository();
- IPersistentMap meta = mocks.StrictMock<IPersistentMap>();
- IFn fn = mocks.StrictMock<IFn>();
- RMExpect.Call(fn.invoke()).Return(10);
- RMExpect.Call(fn.invoke(null)).Return(null);
- mocks.ReplayAll();
-
- _objWithNullMeta = new LazyCons(fn);
- _obj = _objWithNullMeta.withMeta(meta);
- _expectedType = typeof(LazyCons);
-
- mocks.VerifyAll();
- }
- }
-}
diff --git a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
index 99d45e36..049085ea 100644
--- a/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
+++ b/ClojureCLR/Clojure/Clojure.Tests/LibTests/LispReaderTests.cs
@@ -23,7 +23,6 @@ using clojure.lang;
using RMExpect = Rhino.Mocks.Expect;
using java.math;
-using clojure.lang.Readers;
namespace Clojure.Tests.LibTests
@@ -190,9 +189,9 @@ namespace Clojure.Tests.LibTests
#region Helpers
- static TextReader CreatePushbackReaderFromString(string s)
+ static PushbackTextReader CreatePushbackReaderFromString(string s)
{
- return new StringReader(s);
+ return new PushbackTextReader(new StringReader(s));
}
static object ReadFromString(string s)
@@ -200,9 +199,9 @@ namespace Clojure.Tests.LibTests
return LispReader.read(CreatePushbackReaderFromString(s),true,null,false);
}
- static LineNumberingReader CreateLNPBRFromString(string s)
+ static LineNumberingTextReader CreateLNPBRFromString(string s)
{
- return new LineNumberingReader(new StringReader(s));
+ return new LineNumberingTextReader(new StringReader(s));
}
static object ReadFromStringNumbering(string s)
@@ -757,9 +756,9 @@ namespace Clojure.Tests.LibTests
Expect(pl.first(), TypeOf(typeof(Symbol)));
Expect(((Symbol)pl.first()).Name, EqualTo("abc"));
Expect(((Symbol)pl.first()).Namespace, Null);
- Expect(pl.rest().first(), TypeOf(typeof(int)));
- Expect(pl.rest().first(), EqualTo(12));
- Expect(pl.rest().rest(), Null);
+ Expect(pl.next().first(), TypeOf(typeof(int)));
+ Expect(pl.next().first(), EqualTo(12));
+ Expect(pl.next().next(), Null);
}
#endregion
@@ -776,9 +775,9 @@ namespace Clojure.Tests.LibTests
Expect(pl.first(), TypeOf(typeof(Symbol)));
Expect(((Symbol)pl.first()).Name, EqualTo("abc"));
Expect(((Symbol)pl.first()).Namespace, Null);
- Expect(pl.rest().first(), TypeOf(typeof(int)));
- Expect(pl.rest().first(), EqualTo(12));
- Expect(pl.rest().rest(), Null);
+ Expect(pl.next().first(), TypeOf(typeof(int)));
+ Expect(pl.next().first(), EqualTo(12));
+ Expect(pl.next().next(), Null);
}
[Test]
@@ -798,8 +797,8 @@ namespace Clojure.Tests.LibTests
IPersistentList pl = o1 as IPersistentList;
ISeq seq = pl.seq();
Expect(pl.count(), EqualTo(3));
- Expect(seq.rest().first(), InstanceOfType(typeof(IPersistentList)));
- IPersistentList sub = seq.rest().first() as IPersistentList;
+ Expect(seq.next().first(), InstanceOfType(typeof(IPersistentList)));
+ IPersistentList sub = seq.next().first() as IPersistentList;
Expect(sub.count(), EqualTo(2));
}
@@ -990,25 +989,23 @@ namespace Clojure.Tests.LibTests
public void QuoteWraps()
{
object o1 = ReadFromString("'a");
- Expect(o1,InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
- Expect(s.count(),EqualTo(2));
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
+ Expect(s.count(), EqualTo(2));
Expect(s.first(),EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(),TypeOf(typeof(Symbol)));
+ Expect(s.next().first(),TypeOf(typeof(Symbol)));
}
[Test]
public void QuoteWraps2()
{
object o1 = ReadFromString("'(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
@@ -1016,50 +1013,46 @@ namespace Clojure.Tests.LibTests
public void MetaWraps()
{
object o1 = ReadFromString("^a");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core","meta")));
- Expect(s.rest().first(), TypeOf(typeof(Symbol)));
+ Expect(s.next().first(), TypeOf(typeof(Symbol)));
}
[Test]
public void MetaWraps2()
{
object o1 = ReadFromString("^(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "meta")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
[Test]
public void DerefWraps()
{
object o1 = ReadFromString("@a");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "deref")));
- Expect(s.rest().first(), TypeOf(typeof(Symbol)));
+ Expect(s.next().first(), TypeOf(typeof(Symbol)));
}
[Test]
public void DerefWraps2()
{
object o1 = ReadFromString("@(a b c)");
- Expect(o1, InstanceOfType(typeof(IPersistentList)));
- IPersistentList p = o1 as IPersistentList;
- ISeq s = p.seq();
+ Expect(o1, InstanceOfType(typeof(ISeq)));
+ ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core", "deref")));
- Expect(s.rest().first(), InstanceOfType(typeof(IPersistentList)));
- Expect(((IPersistentList)s.rest().first()).count(), EqualTo(3));
+ Expect(s.next().first(), InstanceOfType(typeof(IPersistentList)));
+ Expect(((IPersistentList)s.next().first()).count(), EqualTo(3));
}
#endregion
@@ -1092,8 +1085,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(),EqualTo(2) );
Expect(s.first(),EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(),InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(),InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, Null);
Expect(sym.Name, EqualTo("def"));
}
@@ -1106,8 +1099,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, EqualTo(((Namespace)RT.CURRENT_NS.deref()).Name.Name));
Expect(sym.Name, EqualTo("abc"));
}
@@ -1120,8 +1113,8 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(2));
Expect(s.first(), EqualTo(Symbol.intern("quote")));
- Expect(s.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym = s.rest().first() as Symbol;
+ Expect(s.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym = s.next().first() as Symbol;
Expect(sym.Namespace, Null);
Expect(sym.Name.StartsWith("abc_")); ;
}
@@ -1132,32 +1125,37 @@ namespace Clojure.Tests.LibTests
{
object o1 = ReadFromString("`(abc# abc#)");
// Return should be
- // (clojure/concat (clojure/list (quote abc__N))
- // (clojure/list (quote abc__N))))
+ // (clojure/seq (clojure/concat (clojure/list (quote abc__N))
+ // (clojure/list (quote abc__N)))))
string str = o1.ToString();
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
- Expect(s.count(), EqualTo(3));
- Expect(s.first(), EqualTo(Symbol.intern("clojure.core","concat")));
+ Expect(s.count(),EqualTo(2));
+ Expect(s.first(),EqualTo(Symbol.intern("clojure.core","seq")));
+ Expect(s.next().first(),InstanceOfType(typeof(ISeq)));
+ ISeq s1 = s.next().first() as ISeq;
- Expect(s.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s2 = s.rest().first() as ISeq;
+ Expect(s1.count(), EqualTo(3));
+ Expect(s1.first(), EqualTo(Symbol.intern("clojure.core","concat")));
+
+ Expect(s1.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s2 = s1.next().first() as ISeq;
Expect(s2.count(), EqualTo(2));
- Expect(s2.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s2a = s2.rest().first() as ISeq;
- Expect(s2a.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym1 = s2a.rest().first() as Symbol;
+ Expect(s2.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s2a = s2.next().first() as ISeq;
+ Expect(s2a.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym1 = s2a.next().first() as Symbol;
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3 = s.rest().rest().first() as ISeq;
+ Expect(s1.next().next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3 = s1.next().next().first() as ISeq;
Expect(s3.count(), EqualTo(2));
- Expect(s3.rest().first(), InstanceOfType(typeof(ISeq)));
- ISeq s3a = s3.rest().first() as ISeq;
- Expect(s3a.rest().first(), InstanceOfType(typeof(Symbol)));
- Symbol sym2 = s3a.rest().first() as Symbol;
+ Expect(s3.next().first(), InstanceOfType(typeof(ISeq)));
+ ISeq s3a = s3.next().first() as ISeq;
+ Expect(s3a.next().first(), InstanceOfType(typeof(Symbol)));
+ Symbol sym2 = s3a.next().first() as Symbol;
Expect(sym1.Namespace, Null);
Expect(sym1.Name.StartsWith("abc__"));
@@ -1170,53 +1168,59 @@ namespace Clojure.Tests.LibTests
Object o1 = ReadFromString("`{:a 1 :b 2}");
// (clojure/apply
// clojure/hash-map
- // (clojure/concat (clojure/list :a)
- // (clojure/list 1)
- // (clojure/list :b)
- // (clojure/list 2)))
+ // (clojure/seq
+ // (clojure/concat (clojure/list :a)
+ // (clojure/list 1)
+ // (clojure/list :b)
+ // (clojure/list 2))))
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/hash-map")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/hash-map")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
- ISeq s1 = s.rest().rest().first() as ISeq;
+ ISeq s0 = s.next().next().first() as ISeq;
ISeq s2;
+ Expect(s0.count(), EqualTo(2));
+ Expect(s0.first(), EqualTo(Symbol.intern("clojure.core/seq")));
+ Expect(s0.next().first(),InstanceOfType(typeof(ISeq)));
+ ISeq s1 = s0.next().first() as ISeq;
+
Expect(s1.count(), EqualTo(5));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(),InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(),EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(),EqualTo(Keyword.intern(null,"a")));
+ Expect(s2.next().first(),EqualTo(Keyword.intern(null,"a")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(1));
+ Expect(s2.next().first(), EqualTo(1));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Keyword.intern(null, "b")));
+ Expect(s2.next().first(), EqualTo(Keyword.intern(null, "b")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(2));
+ Expect(s2.next().first(), EqualTo(2));
}
public void SQOnVectorMakesVector()
@@ -1231,29 +1235,29 @@ namespace Clojure.Tests.LibTests
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/vector")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/vector")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
- ISeq s1 = s.rest().rest().first() as ISeq;
+ ISeq s1 = s.next().next().first() as ISeq;
ISeq s2;
Expect(s1.count(), EqualTo(3));
Expect(s1.first(), EqualTo(Symbol.intern("clojure.core/concat")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(Keyword.intern(null, "b")));
+ Expect(s2.next().first(), EqualTo(Keyword.intern(null, "b")));
- s1 = s1.rest();
+ s1 = s1.next();
Expect(s1.first(), InstanceOfType(typeof(ISeq)));
s2 = s1.first() as ISeq;
Expect(s2.first(), EqualTo(Symbol.intern("clojure.core/list")));
- Expect(s2.rest().first(), EqualTo(2));
+ Expect(s2.next().first(), EqualTo(2));
}
[Test]
@@ -1262,34 +1266,40 @@ namespace Clojure.Tests.LibTests
Object o1 = ReadFromString("`#{:b 2}");
// (clojure/apply
// clojure/hash-set
- // (clojure/concat (clojure/list :b)
- // (clojure/list 2)))
+ // (clojure/seq
+ // (clojure/concat (clojure/list :b)
+ // (clojure/list 2))))
Expect(o1, InstanceOfType(typeof(ISeq)));
ISeq s = o1 as ISeq;
Expect(s.count(), EqualTo(3));
Expect(s.first(), EqualTo(Symbol.intern("clojure.core/apply")));
- Expect(s.rest().first(), EqualTo(Symbol.intern("clojure.core/hash-set")));
- Expect(s.rest().rest().first(), InstanceOfType(typeof(ISeq)));
+ Expect(s.next().first(), EqualTo(Symbol.intern("clojure.core/hash-set")));
+ Expect(s.next().next().first(), InstanceOfType(typeof(ISeq)));
+
+ ISeq s0 = s.next().next().first() as ISeq; </