Author: atsushi
Date: 2005-05-12 23:50:32 -0400 (Thu, 12 May 2005)
New Revision: 44484
Added:
trunk/mcs/class/System/System.Collections.Generic/Queue.cs
trunk/mcs/class/System/System.Collections.Generic/Stack.cs
trunk/mcs/class/System/Test/System.Collections.Generic/
trunk/mcs/class/System/Test/System.Collections.Generic/ChangeLog
trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs
trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs
Removed:
trunk/mcs/class/corlib/System.Collections.Generic/Queue.cs
trunk/mcs/class/corlib/System.Collections.Generic/Stack.cs
trunk/mcs/class/corlib/Test/System.Collections.Generic/QueueTest.cs
trunk/mcs/class/corlib/Test/System.Collections.Generic/StackTest.cs
Modified:
trunk/mcs/class/System/ChangeLog
trunk/mcs/class/System/System.Collections.Generic/ChangeLog
trunk/mcs/class/System/System.dll.sources
trunk/mcs/class/System/System_test.dll.sources
trunk/mcs/class/corlib/ChangeLog
trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
trunk/mcs/class/corlib/corlib.dll.sources
trunk/mcs/class/corlib/corlib_test.dll.sources
Log:
2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
* corlib_test.dll.sources,
corlib.dll.sources: generic Queue.cs and Stack.cs are now in System.
* System_test.dll.sources,
System.dll.sources: generic Queue.cs and Stack.cs are now in System.
* Queue.cs, Stack.cs: moved to System.dll
* QueueTest.cs, StackTest.cs: They are now in System.dll
Modified: trunk/mcs/class/System/ChangeLog
===================================================================
--- trunk/mcs/class/System/ChangeLog 2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/System/ChangeLog 2005-05-13 03:50:32 UTC (rev 44484)
@@ -1,3 +1,8 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * System_test.dll.sources,
+ System.dll.sources: generic Queue.cs and Stack.cs are now in System.
+
2005-03-14 Raja R Harinath <[EMAIL PROTECTED]>
* Makefile (NO_INSTALL): Define during the first pass.
Modified: trunk/mcs/class/System/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Collections.Generic/ChangeLog 2005-05-13
02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/System/System.Collections.Generic/ChangeLog 2005-05-13
03:50:32 UTC (rev 44484)
@@ -1,3 +1,7 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * Queue.cs, Stack.cs: moved from mscorlib.dll
+
2005-02-35 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* Collections.cs: Changed the code inside IndexOf, for
Copied: trunk/mcs/class/System/System.Collections.Generic/Queue.cs (from rev
44427, trunk/mcs/class/corlib/System.Collections.Generic/Queue.cs)
Copied: trunk/mcs/class/System/System.Collections.Generic/Stack.cs (from rev
44427, trunk/mcs/class/corlib/System.Collections.Generic/Stack.cs)
Modified: trunk/mcs/class/System/System.dll.sources
===================================================================
--- trunk/mcs/class/System/System.dll.sources 2005-05-13 02:29:58 UTC (rev
44483)
+++ trunk/mcs/class/System/System.dll.sources 2005-05-13 03:50:32 UTC (rev
44484)
@@ -129,6 +129,8 @@
System.CodeDom/MemberAttributes.cs
System.Collections.Generic/Collection.cs
System.Collections.Generic/ReadOnlyCollection.cs
+System.Collections.Generic/Queue.cs
+System.Collections.Generic/Stack.cs
System.Collections.Specialized/BitVector32.cs
System.Collections.Specialized/CollectionsUtil.cs
System.Collections.Specialized/HybridDictionary.cs
Modified: trunk/mcs/class/System/System_test.dll.sources
===================================================================
--- trunk/mcs/class/System/System_test.dll.sources 2005-05-13 02:29:58 UTC
(rev 44483)
+++ trunk/mcs/class/System/System_test.dll.sources 2005-05-13 03:50:32 UTC
(rev 44484)
@@ -10,6 +10,8 @@
System/UriTest.cs
System/UriTest2.cs
System.CodeDom.Compiler/IndentedTextWriterTest.cs
+System.Collections.Generic/QueueTest.cs
+System.Collections.Generic/StackTest.cs
System.Collections.Specialized/BasicOperationsTest.cs
System.Collections.Specialized/BitVector32Test.cs
System.Collections.Specialized/HybridDictionaryTest.cs
Added: trunk/mcs/class/System/Test/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Collections.Generic/ChangeLog
2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/System/Test/System.Collections.Generic/ChangeLog
2005-05-13 03:50:32 UTC (rev 44484)
@@ -0,0 +1,4 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * QueueTest.cs, StackTest.cs: moved from mscorlib test.
+
Copied: trunk/mcs/class/System/Test/System.Collections.Generic/QueueTest.cs
(from rev 44427,
trunk/mcs/class/corlib/Test/System.Collections.Generic/QueueTest.cs)
Copied: trunk/mcs/class/System/Test/System.Collections.Generic/StackTest.cs
(from rev 44427,
trunk/mcs/class/corlib/Test/System.Collections.Generic/StackTest.cs)
Modified: trunk/mcs/class/corlib/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/ChangeLog 2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/ChangeLog 2005-05-13 03:50:32 UTC (rev 44484)
@@ -1,3 +1,8 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * corlib_test.dll.sources,
+ corlib.dll.sources: generic Queue.cs and Stack.cs are now in System.
+
2005-05-12 Atsushi Enomoto <[EMAIL PROTECTED]>
* corlib.dll.sources: replaced MiniParser.cs with SmallXmlParser.cs.
Modified: trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-05-13
02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-05-13
03:50:32 UTC (rev 44484)
@@ -1,3 +1,7 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * Queue.cs, Stack.cs: moved to System.dll
+
2005-05-06 Martin Baulig <[EMAIL PROTECTED]>
* *.cs: Add CLSCompliant(true) where missing.
Deleted: trunk/mcs/class/corlib/System.Collections.Generic/Queue.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/Queue.cs 2005-05-13
02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/System.Collections.Generic/Queue.cs 2005-05-13
03:50:32 UTC (rev 44484)
@@ -1,317 +0,0 @@
-//
-// System.Collections.Generic.Queue
-//
-// Author:
-// Martin Baulig ([EMAIL PROTECTED])
-// Ben Maurer ([EMAIL PROTECTED])
-//
-// (C) 2003, 2004 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- [ComVisible(false)]
- public class Queue<T> : ICollection<T>, ICollection
- {
- T [] data;
- int head;
- int tail;
- int size;
- int version;
-
- public Queue ()
- {
- }
-
- public Queue (int count)
- {
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- data = new T [count];
- }
-
- public Queue (IEnumerable <T> collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
-
- foreach (T t in collection)
- Enqueue (t);
- }
-
- public void Clear ()
- {
- if (data != null)
- Array.Clear (data, 0, data.Length);
-
- head = tail = size = 0;
- }
-
- public bool Contains (T item)
- {
- if (item == null) {
- foreach (T t in this)
- if (t == null)
- return true;
- } else {
- foreach (T t in this)
- if (item.Equals (t))
- return true;
- }
-
- return false;
- }
-
- public void CopyTo (T [] array, int idx)
- {
- if (array == null)
- throw new ArgumentNullException ();
-
- if ((uint) idx > (uint) array.Length)
- throw new ArgumentOutOfRangeException ();
-
- if (array.Length - idx < size)
- throw new ArgumentOutOfRangeException ();
-
- if (size == 0)
- return;
-
- int contents_length = data.Length;
- int length_from_head = contents_length - head;
-
- Array.Copy (data, head, array, idx, Math.Min (size,
length_from_head));
- if (size > length_from_head)
- Array.Copy (data, 0, array,
- idx + length_from_head,
- size - length_from_head);
-
- }
-
- void ICollection.CopyTo (Array array, int idx)
- {
- if (array == null)
- throw new ArgumentNullException ();
-
- if ((uint) idx < (uint) array.Length)
- throw new ArgumentOutOfRangeException ();
-
- if (array.Length - idx < size)
- throw new ArgumentOutOfRangeException ();
-
- if (size == 0)
- return;
-
- try {
- int contents_length = data.Length;
- int length_from_head = contents_length - head;
-
- Array.Copy (data, head, array, idx, Math.Min
(size, length_from_head));
- if (size > length_from_head)
- Array.Copy (data, 0, array,
- idx + length_from_head,
- size - length_from_head);
- } catch (ArrayTypeMismatchException) {
- throw new ArgumentException ();
- }
- }
-
- public T Dequeue ()
- {
- T ret = Peek ();
-
- // clear stuff out to make the GC happy
- data [head] = default (T);
-
- if (++head == data.Length)
- head = 0;
- size --;
- version ++;
-
- return ret;
- }
-
- public T Peek ()
- {
- if (size == 0)
- throw new InvalidOperationException ();
-
- return data [head];
- }
-
- public void Enqueue (T item)
- {
- if (data == null || size == data.Length)
- SetCapacity (Math.Max (size * 2, 4));
-
- data [tail] = item;
-
- if (++tail == data.Length)
- tail = 0;
-
- size ++;
- version ++;
- }
-
- public T [] ToArray ()
- {
- T [] t = new T [size];
- CopyTo (t, 0);
- return t;
- }
-
- public void TrimToSize ()
- {
- SetCapacity (size);
- }
-
- void SetCapacity (int new_size)
- {
- if (data != null && new_size == data.Length)
- return;
-
- if (new_size < size)
- throw new InvalidOperationException ("shouldnt
happen");
-
- T [] new_data = new T [new_size];
- if (size > 0)
- CopyTo (new_data, 0);
-
- data = new_data;
- tail = size;
- head = 0;
- version ++;
- }
-
- public int Count {
- get { return size; }
- }
-
-
- bool ICollection <T>.IsReadOnly {
- get { return false; }
- }
-
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return this; }
- }
-
- void ICollection <T>.Add (T t)
- {
- Enqueue (t);
- }
-
- bool ICollection <T>.Remove (T t)
- {
- throw new InvalidOperationException ("");
- }
-
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- IEnumerator <T> IEnumerable<T>.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- public struct Enumerator : IEnumerator <T>, IEnumerator,
IDisposable {
- const int NOT_STARTED = -2;
-
- // this MUST be -1, because we depend on it in move
next.
- // we just decr the size, so, 0 - 1 == FINISHED
- const int FINISHED = -1;
-
- Queue <T> q;
- int idx;
- int ver;
-
- internal Enumerator (Queue <T> q)
- {
- this.q = q;
- idx = NOT_STARTED;
- ver = q.version;
- }
-
- // for some fucked up reason, MSFT added a useless
dispose to this class
- // It means that in foreach, we must still do a
try/finally. Broken, very
- // broken.
- public void Dispose ()
- {
- idx = NOT_STARTED;
- }
-
- public bool MoveNext ()
- {
- if (ver != q.version)
- throw new InvalidOperationException ();
-
- if (idx == NOT_STARTED)
- idx = q.size;
-
- return idx != FINISHED && -- idx != FINISHED;
- }
-
- public T Current {
- get {
- if (idx < 0)
- throw new
InvalidOperationException ();
-
- return q.data [(q.size - 1 - idx +
q.head) % q.data.Length];
- }
- }
-
- void IEnumerator.Reset ()
- {
- if (ver != q.version)
- throw new InvalidOperationException ();
-
- idx = NOT_STARTED;
- }
-
- object IEnumerator.Current {
- get { return Current; }
- }
-
- }
- }
-}
-#endif
Deleted: trunk/mcs/class/corlib/System.Collections.Generic/Stack.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/Stack.cs 2005-05-13
02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/System.Collections.Generic/Stack.cs 2005-05-13
03:50:32 UTC (rev 44484)
@@ -1,262 +0,0 @@
-//
-// System.Collections.Generic.Stack
-//
-// Authors:
-// Martin Baulig ([EMAIL PROTECTED])
-// Ben Maurer ([EMAIL PROTECTED])
-//
-// (C) 2003, 2004 Novell, Inc.
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Collections.Generic
-{
- [ComVisible (false)]
- public class Stack <T> : ICollection <T>, IEnumerable <T>, ICollection,
IEnumerable {
-
- T [] data;
- int size;
- int ver;
-
- public Stack ()
- {
- }
-
- public Stack (int count)
- {
- if (count < 0)
- throw new ArgumentOutOfRangeException ("count");
-
- data = new T [count];
- }
-
- public Stack (IEnumerable <T> collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
-
- ICollection <T> col = collection as ICollection <T>;
-
-
- if (col != null) {
- size = col.Count;
- data = new T [size];
- col.CopyTo (data, 0);
- } else {
- foreach (T t in collection)
- Push (t);
- }
- }
-
- public void Clear ()
- {
- if (data != null)
- Array.Clear (data, 0, data.Length);
-
- size = 0;
- ver ++;
- }
-
- public bool Contains (T t)
- {
- return data != null && Array.IndexOf (data, t, 0, size)
!= -1;
- }
-
- public void CopyTo (T [] dest, int idx)
- {
- // this gets copied in the order that it is poped
- if (data != null) {
- Array.Copy (data, 0, dest, idx, size);
- Array.Reverse (dest, idx, size);
- }
- }
-
- public T Peek ()
- {
- if (size == 0)
- throw new InvalidOperationException ();
-
- ver ++;
-
- return data [size - 1];
- }
-
- public T Pop ()
- {
- if (size == 0)
- throw new InvalidOperationException ();
-
- ver ++;
-
- return data [-- size];
- }
-
- public void Push (T t)
- {
- if (size == 0 || size == data.Length)
- Array.Resize <T> (ref data, size == 0 ? 10 : 2
* size);
-
- ver ++;
-
- data [size++] = t;
- }
-
- public T [] ToArray ()
- {
- T [] copy = new T [size];
- CopyTo (copy, 0);
- return copy;
- }
-
- public void TrimToSize ()
- {
- // for some broken reason, msft increments the version
here
- ver ++;
-
- if (size == 0)
- data = null;
- else
- Array.Resize <T> (ref data, size);
- }
-
- public int Count {
- get { return size; }
- }
-
- bool ICollection <T>.IsReadOnly {
- get { return false; }
- }
-
- bool ICollection.IsSynchronized {
- get { return false; }
- }
-
- object ICollection.SyncRoot {
- get { return this; }
- }
-
- void ICollection <T>.Add (T t)
- {
- Push (t);
- }
-
- bool ICollection <T>.Remove (T t)
- {
- throw new InvalidOperationException ("");
- }
-
- void ICollection.CopyTo (Array dest, int idx)
- {
- try {
- if (data != null) {
- data.CopyTo (dest, idx);
- Array.Reverse (dest, idx, size);
- }
- } catch (ArrayTypeMismatchException) {
- throw new ArgumentException ();
- }
- }
-
- public Enumerator GetEnumerator ()
- {
- return new Enumerator (this);
- }
-
- IEnumerator <T> IEnumerable<T>.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- public struct Enumerator : IEnumerator <T>, IEnumerator,
IDisposable {
- const int NOT_STARTED = -2;
-
- // this MUST be -1, because we depend on it in move
next.
- // we just decr the size, so, 0 - 1 == FINISHED
- const int FINISHED = -1;
-
- Stack <T> parent;
- int idx;
- int ver;
-
- internal Enumerator (Stack <T> t)
- {
- parent = t;
- idx = NOT_STARTED;
- ver = t.ver;
- }
-
- // for some fucked up reason, MSFT added a useless
dispose to this class
- // It means that in foreach, we must still do a
try/finally. Broken, very
- // broken.
- public void Dispose ()
- {
- idx = NOT_STARTED;
- }
-
- public bool MoveNext ()
- {
- if (ver != parent.ver)
- throw new InvalidOperationException ();
-
- if (idx == -2)
- idx = parent.size;
-
- return idx != FINISHED && -- idx != FINISHED;
- }
-
- public T Current {
- get {
- if (idx < 0)
- throw new
InvalidOperationException ();
-
- return parent.data [idx];
- }
- }
-
- void IEnumerator.Reset ()
- {
- if (ver != parent.ver)
- throw new InvalidOperationException ();
-
- idx = NOT_STARTED;
- }
-
- object IEnumerator.Current {
- get { return Current; }
- }
-
- }
- }
-}
-#endif
Modified: trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
2005-05-13 03:50:32 UTC (rev 44484)
@@ -1,3 +1,7 @@
+2005-05-13 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * QueueTest.cs, StackTest.cs: They are now in System.dll
+
2005-05-05 Raja R Harinath <[EMAIL PROTECTED]>
* DictionaryTest.cs (MyTest.GetHashCode): Add to silence a
Deleted: trunk/mcs/class/corlib/Test/System.Collections.Generic/QueueTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Collections.Generic/QueueTest.cs
2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/Test/System.Collections.Generic/QueueTest.cs
2005-05-13 03:50:32 UTC (rev 44484)
@@ -1,234 +0,0 @@
-//
-// Queue.cs
-//
-// Author:
-// Ben Maurer ([EMAIL PROTECTED])
-//
-
-#if NET_2_0
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-namespace MonoTests.System.Collections.Generic {
- [TestFixture]
- public class QueueTest : Assertion
- {
- [Test]
- public void TestCtor ()
- {
- Queue <int> a = new Queue <int> ();
- Queue <int> b = new Queue <int> (1);
- Queue <object> c = new Queue <object> ();
- Queue <object> d = new Queue <object> (1);
- Queue <object> e = new Queue <object> (0);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void TestCtorEx ()
- {
- Queue <int> a = new Queue <int> (-1);
- }
-
- [Test]
- public void TestCtorEnum ()
- {
- List <int> l = new List <int> ();
- l.Add (1);
- l.Add (2);
- l.Add (3);
-
- Queue <int> s = new Queue <int> (l);
-
- AssertDequeue (s, 1);
- AssertDequeue (s, 2);
- AssertDequeue (s, 3);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void TestCtorEnumNull ()
- {
- Queue <int> s = new Queue <int> (null);
- }
-
- [Test]
- public void TestClear()
- {
- Queue <int> s = new Queue <int> ();
- s.Clear ();
-
- AssertEquals (s.Count, 0);
-
- s.Enqueue (1);
- s.Enqueue (2);
-
- AssertEquals (s.Count, 2);
-
- s.Clear ();
-
- AssertEquals (s.Count, 0);
- }
-
- [Test]
- public void TestContains ()
- {
- Stack <int> s = new Stack <int> ();
-
- AssertEquals (s.Contains (1), false);
-
- s.Push (1);
-
- AssertEquals (s.Contains (1), true);
- AssertEquals (s.Contains (0), false);
- }
-
- [Test]
- public void TestCopyTo ()
- {
- int [] x = new int [3];
- Queue <int> z = new Queue <int> ();
- z.Enqueue (1);
- z.Enqueue (2);
- x [0] = 10;
- z.CopyTo (x, 1);
-
- AssertEquals (x [0], 10);
- AssertEquals (x [1], 1);
- AssertEquals (x [2], 2);
- }
-
- [Test]
- public void TestPeek ()
- {
- Queue <int> s = new Queue <int> ();
- s.Enqueue (1);
-
- AssertEquals (s.Peek (), 1);
- AssertEquals (s.Count, 1);
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPeekEx ()
- {
- Queue <int> s = new Queue <int> ();
- s.Peek ();
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPeekEx2 ()
- {
- Queue <int> s = new Queue <int> ();
- s.Enqueue (1);
- s.Dequeue ();
- s.Peek ();
- }
-
- [Test]
- public void TestDequeue ()
- {
- Queue <int> s = new Queue <int> ();
- s.Enqueue (1);
-
- AssertEquals (s.Dequeue (), 1);
- AssertEquals (s.Count, 0);
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestDequeueEx ()
- {
- Queue <int> s = new Queue <int> ();
- s.Dequeue ();
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestDequeueEx2 ()
- {
- Queue <int> s = new Queue <int> ();
- s.Enqueue (1);
- s.Dequeue ();
- s.Dequeue ();
- }
-
- [Test]
- public void TestEnqueue ()
- {
- Queue <int> s = new Queue <int> ();
- s.Enqueue (1);
- AssertEquals (s.Count, 1);
- s.Enqueue (2);
- AssertEquals (s.Count, 2);
-
- for (int i = 0; i < 100; i ++)
- s.Enqueue (i);
-
- AssertEquals (s.Count, 102);
- }
-
- [Test]
- public void TestToArray ()
- {
- Queue <int> s = new Queue <int> ();
-
- int [] x = s.ToArray ();
-
- AssertEquals (x.Length, 0);
-
- s.Enqueue (1);
- x = s.ToArray ();
- AssertEquals (x.Length, 1);
- AssertEquals (x [0], 1);
- }
-
- [Test]
- public void TestTrimToSize ()
- {
- Queue <int> s = new Queue <int> ();
- s.TrimToSize ();
- s.Enqueue (1);
- s.TrimToSize ();
- }
-
- [Test]
- public void TestEnumerator ()
- {
- Queue <int> s = new Queue <int> ();
-
- foreach (int x in s)
- Fail ();
-
- s.Enqueue (1);
-
- int i = 0;
-
- foreach (int x in s) {
- AssertEquals (i, 0);
- AssertEquals (x, 1);
- i ++;
- }
-
- for (i = 2; i < 100; i ++)
- s.Enqueue (i);
-
- i = 1;
-
- foreach (int x in s) {
- AssertEquals (x, i);
- i ++;
- }
- }
-
- void AssertDequeue <T> (Queue <T> s, T t)
- {
- AssertEquals (s.Dequeue (), t);
- }
- }
-}
-#endif
\ No newline at end of file
Deleted: trunk/mcs/class/corlib/Test/System.Collections.Generic/StackTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Collections.Generic/StackTest.cs
2005-05-13 02:29:58 UTC (rev 44483)
+++ trunk/mcs/class/corlib/Test/System.Collections.Generic/StackTest.cs
2005-05-13 03:50:32 UTC (rev 44484)
@@ -1,236 +0,0 @@
-//
-// StackTest.cs
-//
-// Author:
-// Ben Maurer ([EMAIL PROTECTED])
-//
-
-#if NET_2_0
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-using NUnit.Framework;
-
-namespace MonoTests.System.Collections.Generic {
- [TestFixture]
- public class StackTest: Assertion
- {
- [Test]
- public void TestCtor ()
- {
- Stack <int> a = new Stack <int> ();
- Stack <int> b = new Stack <int> (1);
- Stack <object> c = new Stack <object> ();
- Stack <object> d = new Stack <object> (1);
- Stack <object> e = new Stack <object> (0);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
- public void TestCtorEx ()
- {
- Stack <int> a = new Stack <int> (-1);
- }
-
- [Test]
- public void TestCtorEnum ()
- {
- List <int> l = new List <int> ();
- l.Add (1);
- l.Add (2);
- l.Add (3);
-
- Stack <int> s = new Stack <int> (l);
-
- // Things get pop'd in reverse
- AssertPop (s, 3);
- AssertPop (s, 2);
- AssertPop (s, 1);
- }
-
- [Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void TestCtorEnumNull ()
- {
- Stack <int> s = new Stack <int> (null);
- }
-
- [Test]
- public void TestClear()
- {
- Stack <int> s = new Stack <int> ();
- s.Clear ();
-
- AssertEquals (s.Count, 0);
-
- s.Push (1);
- s.Push (2);
-
- AssertEquals (s.Count, 2);
-
- s.Clear ();
-
- AssertEquals (s.Count, 0);
- }
-
- [Test]
- public void TestContains ()
- {
- Stack <int> s = new Stack <int> ();
-
- AssertEquals (s.Contains (1), false);
-
- s.Push (1);
-
- AssertEquals (s.Contains (1), true);
- AssertEquals (s.Contains (0), false);
- }
-
- [Test]
- public void TestCopyTo ()
- {
- int [] x = new int [3];
- Stack <int> z = new Stack <int> ();
- z.Push (1);
- z.Push (2);
- x [0] = 10;
- z.CopyTo (x, 1);
-
- AssertEquals (x [0], 10);
- AssertEquals (x [1], 2);
- AssertEquals (x [2], 1);
- }
-
- [Test]
- public void TestPeek ()
- {
- Stack <int> s = new Stack <int> ();
- s.Push (1);
-
- AssertEquals (s.Peek (), 1);
- AssertEquals (s.Count, 1);
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPeekEx ()
- {
- Stack <int> s = new Stack <int> ();
- s.Peek ();
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPeekEx2 ()
- {
- Stack <int> s = new Stack <int> ();
- s.Push (1);
- s.Pop ();
- s.Peek ();
- }
-
- [Test]
- public void TestPop ()
- {
- Stack <int> s = new Stack <int> ();
- s.Push (1);
-
- AssertEquals (s.Pop (), 1);
- AssertEquals (s.Count, 0);
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPopEx ()
- {
- Stack <int> s = new Stack <int> ();
- s.Pop ();
- }
-
- [Test]
- [ExpectedException (typeof (InvalidOperationException))]
- public void TestPopEx2 ()
- {
- Stack <int> s = new Stack <int> ();
- s.Push (1);
- s.Pop ();
- s.Pop ();
- }
-
- [Test]
- public void TestPush ()
- {
- Stack <int> s = new Stack <int> ();
- s.Push (1);
- AssertEquals (s.Count, 1);
- s.Push (2);
- AssertEquals (s.Count, 2);
-
- for (int i = 0; i < 100; i ++)
- s.Push (i);
-
- AssertEquals (s.Count, 102);
- }
-
- [Test]
- public void TestToArray ()
- {
- Stack <int> s = new Stack <int> ();
-
- int [] x = s.ToArray ();
-
- AssertEquals (x.Length, 0);
-
- s.Push (1);
- x = s.ToArray ();
- AssertEquals (x.Length, 1);
- AssertEquals (x [0], 1);
- }
-
- [Test]
- public void TestTrimToSize ()
- {
- Stack <int> s = new Stack <int> ();
- s.TrimToSize ();
- s.Push (1);
- s.TrimToSize ();
- }
-
- [Test]
- public void TestEnumerator ()
- {
- Stack <int> s = new Stack <int> ();
-
- foreach (int x in s)
- Fail ();
-
- s.Push (1);
-
- int i = 0;
-
- foreach (int x in s) {
- AssertEquals (i, 0);
- AssertEquals (x, 1);
- i ++;
- }
-
- i = 0;
-
- s.Push (2);
- s.Push (3);
-
- foreach (int x in s) {
- AssertEquals (x, 3 - i);
- Assert (i < 3);
- i ++;
- }
- }
-
- void AssertPop <T> (Stack <T> s, T t)
- {
- AssertEquals (s.Pop (), t);
- }
- }
-}
-#endif
\ No newline at end of file
Modified: trunk/mcs/class/corlib/corlib.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib.dll.sources 2005-05-13 02:29:58 UTC (rev
44483)
+++ trunk/mcs/class/corlib/corlib.dll.sources 2005-05-13 03:50:32 UTC (rev
44484)
@@ -1241,8 +1241,6 @@
System.Collections.Generic/IKeyComparer.cs
System.Collections.Generic/KeyValuePair.cs
System.Collections.Generic/KeyNotFoundException.cs
-System.Collections.Generic/Queue.cs
-System.Collections.Generic/Stack.cs
System.Collections.Generic/List.cs
System/Action.cs
System/ArraySegment.cs
Modified: trunk/mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib_test.dll.sources 2005-05-13 02:29:58 UTC
(rev 44483)
+++ trunk/mcs/class/corlib/corlib_test.dll.sources 2005-05-13 03:50:32 UTC
(rev 44484)
@@ -28,8 +28,6 @@
System.Collections/SortedListTest.cs
System.Collections/StackTest.cs
System.Collections.Generic/DictionaryTest.cs
-System.Collections.Generic/StackTest.cs
-System.Collections.Generic/QueueTest.cs
System/ConsoleTest.cs
System/ConvertTest.cs
System/DateTimeTest.cs
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches