Commit Graph
75 Commits
Author SHA1 Message Date
Alexander Köplinger 48e112d652 [Cleanup] Removed TARGET_JVM
It was once part of a special Java target profile, but this is no longer used today.
2014-08-08 03:28:34 +02:00
Marek Safar 27feeb5a9a [corlib] Reset List enumerator current field. Fixes #17760 2014-02-13 22:26:13 +01:00
Marek Safar f43d02d563 [corlib] Default comparer uses IComparable interface only 2014-02-07 20:07:45 +01:00
Marek Safar 8006bd5011 [corlib] Set initialized List<T> capacity to match input enumeration. Fixes #16318 2013-11-29 20:40:07 +01:00
Marek Safar c6989ab9f9 Unify Array/List FindIndex/FindLastIndex handling and argument checking. Fixes #14632 2013-09-13 14:51:08 +02:00
Rodrigo Kumpera f378e23a3f Since NET_2_1 implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:41:51 -05:00
Rodrigo Kumpera ba0d918de5 Fix compilation issue with corlib 2.0 test suite. 2012-03-21 18:20:06 -03:00
Marek Safar 22c09b95aa Implement Comparer::Create 2012-03-19 17:15:49 +00:00
Andres G. Aragoneses 1611e51eec corlib: List's enumerator should not mutate after being disposed
List<T>.Enumerator is a struct so current Dispose() implementation was causing mutability on it.
Depending on this behaviour may seem overkill but some codebases may implement IEnumerator<T> themselves by caching the enumerator of their initial readonly list.

Making Dispose() not do anything may seem incorrect, but it is not. For a good read about this, take a look at Stephen Cleary's first comment in:
http://social.msdn.microsoft.com/Forums/en/netfxbcl/thread/f5a59eac-4a3e-4417-99a8-83d4a6a9e41d

(Added NUnit tests that demonstrate the issue too.)

For a good example: this fix makes a simple HelloWorld System.Web.IHttpHandler work in Mono within the OpenRasta framework (at least tested with the stable branch).
2012-03-02 12:50:19 +00:00
Zoltan Varga 2e0324b2ff Fix List.LastIndexOf () on empty lists. Fixes #2558. 2011-12-19 12:21:31 +01:00
Miguel de Icaza 2852ed0b59 Update copyrights 2011-09-13 18:26:13 -04:00
Sebastien Pouliot 0466ae48a3 Adjust corlib unit tests to reduce failures when executed on the NET_2_1 profile 2011-09-09 13:43:15 -04:00
Jb Evain af6f63eb79 Add test for bug #703027. 2011-06-30 01:23:24 +02:00
Jb Evain fc8c405d60 Add test for #69918 2011-06-10 11:11:45 +02:00
Rodrigo Kumpera 750ddb7846 Properly check arguments in List<T> ICollection.CopyTo.
* List.cs (ICollection.CopyTo): Properly check
	the array argument to match MS semantics.

	Fixes #672907
2011-02-22 18:48:32 +01:00
Jb Evain 83dc82203d disable broken tests on net_4_0
svn path=/trunk/mcs/; revision=158391
2010-06-03 10:08:38 +00:00
Robert Jordan c42abafd5b In System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* Dictionary.cs: Fix deserialization compatibility with MS.NET.
	Fixes bug #474009.

In Test/System.Collections.Generic:
2010-01-24  Robert Jordan  <[email protected]>

	* DictionaryTest.cs: Add test case for bug #474009.


svn path=/trunk/mcs/; revision=150089
2010-01-24 01:04:18 +00:00
Raja R Harinath 162d3490c5 Dictionary: Ensure that invalid arrays to CopyTo result in ArgumentExceptions.
* System.Collections.Generic/Dictionary.cs (CopyToCheck, Do_CopyTo):
Carve out of ...
(CopyTo): ... this.
(Do_ICollectionCopyTo): Carve out of ICollection.CopyTo.  Convert
type-cast exceptions to ArgumentExceptions.
(KeyCollection.CopyTo): Use them.
(ValueCollection.CopyTo): Use them.
* Test/System.Collections.Generic/DictionaryTest.cs (ICollectionCopyTo):
Test various odd scenarios where .NET CopyTo does _not_ throw an exception.
(ICollectionCopyTo_ex1..4): Ensure that ArgumentExceptions are
thrown in appropriate cases.

svn path=/trunk/mcs/; revision=142427
2009-09-22 17:39:52 +00:00
Raja R Harinath f741a048f0 IList implementation: convert NullReferenceException to ArgumentException
* List.cs (IList.this.set): Convert NullReference and InvalidCast
exceptions into ArgumentExceptions.
(IList.Add, IList.Contains, IList.IndexOf, IList.Insert, IList.Remove):
Convert NullReferenceException to ArgumentException.
* ListTest.cs: Add a few testcases for IList interface, using null
values with a List<int>.

svn path=/trunk/mcs/; revision=139159
2009-07-31 10:25:04 +00:00
Raja R Harinath 1e3534eca1 Test the Dictionary Keys and Values slices
* DictionaryTest.cs (KeyEnumerator_Current): New test.  Test the
Keys slice enumerator.
(ValueEnumerator_Current): Likewise, for the Values slice.

svn path=/trunk/mcs/; revision=139117
2009-07-30 19:47:53 +00:00
Raja R Harinath ef326448f4 List<>-relevant fix for #491858 and #517415
* System.Collections.Generic/List.cs (Enumerator.current): New.
(Enumerator.MoveNext): Update it.
(Enumerator.Current): Don't verify any invariants.
(Enumerator.Dispose): Set 'l' to null.
* Test/System.Collections.Generic/ListTest.cs (Enumerator_Current):
New test, includes relevant parts of #491858 and #517415.

svn path=/trunk/mcs/; revision=139087
2009-07-30 14:55:24 +00:00
Raja R Harinath a22621964d Fix Dictionary<,>-relevant parts of #491858 and #517415
* System.Collections.Generic/Dictionary.cs (Enumerator.current): New.
(Enumerator.MoveNext): Update it.
(Enumerator.Current): Don't verify any invariants.
* Test/System.Collections.Generic/DictionaryTest.cs (Enumerator_Current):
New test, includes relevant parts of #491858 and #517415.

svn path=/trunk/mcs/; revision=139082
2009-07-30 13:52:39 +00:00
Jb Evain 65f396a229 2009-04-02 Jb Evain <[email protected]>
* DictionaryTest.cs: add test for bug #328036.


svn path=/trunk/mcs/; revision=130885
2009-04-02 17:33:53 +00:00
Jb Evain 89b0dc7b11 2008-11-14 Jb Evain <[email protected]>
* DictionaryTest.cs: add tests for #444778.


svn path=/trunk/mcs/; revision=118842
2008-11-14 11:47:36 +00:00
Jb Evain 0338541bbc 2008-11-14 Jb Evain <[email protected]>
* DictionaryTest.cs: add tests for bug #444768.


svn path=/trunk/mcs/; revision=118839
2008-11-14 10:36:55 +00:00
Zoltan Varga 2785965055 2008-10-06 Zoltan Varga <[email protected]>
* DictionaryTest.cs: Add a test for #432441.

svn path=/trunk/mcs/; revision=114916
2008-10-06 03:38:50 +00:00
Jb Evain 3ab1fbeb90 2008-09-29 Jb Evain <[email protected]>
* DictionaryTest.cs: test for null argument for ContainsKey.
	Patch by Jonathan Anderson  <[email protected]>


svn path=/trunk/mcs/; revision=114372
2008-09-29 07:44:17 +00:00
Jb Evain abb97797a2 2008-09-24 Jb Evain <[email protected]>
* DictionaryTest.cs: add tests for bug #429530.


svn path=/trunk/mcs/; revision=113953
2008-09-24 13:33:27 +00:00
Jb Evain fd6f6c88a8 2008-09-12 Jb Evain <[email protected]>
* DictionaryTest.cs: add tests for #425693.


svn path=/trunk/mcs/; revision=112908
2008-09-12 21:01:51 +00:00
Andreas N 26c0c9d1dd 2008-06-16 Andreas Nahr <[email protected]>
* DictionaryTest.cs: Add test for an incompatibility

svn path=/trunk/mcs/; revision=105871
2008-06-15 23:01:30 +00:00
Gert Driesen 17e1a45680 * DictionaryTest.cs: Added not working tests for bug #384723. Spaces
to tabs.

svn path=/trunk/mcs/; revision=102188
2008-04-30 09:49:39 +00:00
Sebastien Pouliot 320c4febec 2008-03-21 Sebastien Pouliot <[email protected]>
* EqualityComparerTest.cs: New. Add test cases for using null with 
	GetHashCode (bug #372892).


svn path=/trunk/mcs/; revision=98738
2008-03-21 14:41:52 +00:00
Zoltan Varga d3000844fc 2008-01-06 Zoltan Varga <[email protected]>
* ListTest.cs: Make some tests public.

svn path=/trunk/mcs/; revision=92369
2008-01-06 22:04:05 +00:00
Sebastien Pouliot 5b59c8d0c5 2007-11-05 Sebastien Pouliot <[email protected]>
* DictionaryTest.cs: Test case for #322783 based on Francisco Moraes
	sample code.


svn path=/trunk/mcs/; revision=88941
2007-11-05 23:53:05 +00:00
Miguel de Icaza 2c01aa0209 Patch from Juraj:
2007-10-10  Juraj Skripsky <[email protected]>

	* Dictionary.cs (Enumerator.MoveNext): Handle the case where we
	had already reached the end. Fixes bug #332534.



svn path=/trunk/mcs/; revision=88534
2007-10-31 04:10:33 +00:00
Jonathan Chambers db996d0993 Fix test.
svn path=/trunk/mcs/; revision=75803
2007-04-17 02:04:53 +00:00
Jonathan Chambers 1888bc79f1 2006-04-16 Jonathan Chambers <[email protected]>
* List.cs: Clear entry in RemoveAt after removing item. 
	Fixes bug #81387.

svn path=/trunk/mcs/; revision=75788
2007-04-16 20:54:22 +00:00
Miguel de Icaza 926556e10b 2007-03-20 Juan Cristóbal Olivares <[email protected]>
* List.cs (FindAll): Optimize FindAll using a bitmask to
        * determine
        the number of positive matches, this increases the performance
in
        all cases below 10,000,000 elements extensively:

        100 elements:
        old method:             00:00:00.0126610 (26x)
        stackalloc bit method:  00:00:00.0004750 (1x)
        array bit method:       00:00:00.0010700 (2x)
        heap bit method:        00:00:00.0038830 (8x)

        1,000 elements:
        old method:             00:00:00.0139250 (24x)
        stackalloc bit method:  00:00:00.0005670 (1x)
        array bit method:       00:00:00.0010890 (2x)
        heap bit method:        00:00:00.0034920 (6x)

        10,000 elements:
        old method:             00:00:00.0136110 (12x)
        stackalloc bit method:  00:00:00.0011240 (1x)
        array bit method:       00:00:00.0016450 (1.4x)
        heap bit method:        00:00:00.0043110 (3x)

        50,000 elements:
        old method:             00:00:00.0175970 (3x)
        stackalloc bit method:  00:00:00.0085630 (1.5x)
        array bit method:       00:00:00.0055010 (1x)
        heap bit method:        00:00:00.0099590 (1.8x)

        100,000 elements:
        old method:             00:00:00.0210330 (2x)
        array bit method:       00:00:00.0100430 (1x)
        heap bit method:        00:00:00.0154150 (1.5x)

        1,000,000 elements:
        old method:             00:00:00.1243730 (1.2x)
        array bit method:       00:00:00.0973110 (1x)
        heap bit method:        00:00:00.1285650 (1.3x)

        10,000,000 elements:
        old method:             00:00:00.9252570 (1x)
        array bit method:       00:00:00.9632300 ( 1.05x)
        heap bit method:        00:00:01.1098490 (1.20x)



svn path=/trunk/mcs/; revision=74694
2007-03-20 15:39:19 +00:00
Eyal Alalouf 30c28c41d7 Mark tests as not working under TARGET_JVM
svn path=/trunk/mcs/; revision=74246
2007-03-14 10:47:05 +00:00
Miguel de Icaza 56b8eb3982 Fix
svn path=/trunk/mcs/; revision=73984
2007-03-09 02:43:40 +00:00
Miguel de Icaza 93935ee66c Fix
svn path=/trunk/mcs/; revision=73983
2007-03-09 02:41:23 +00:00
Miguel de Icaza 929fcbd4fa 2007-03-08 David Mitchell <[email protected]>
* List.cs: Fix the case where List.set_Item(int index) throws
	inappropriate exception when index is equal to List.Count

	List.IndexOf(object item) and IList.Contains(object item) throw
	exceptions when given invalid types.

	IList.Add(object item) throws InvalidCastException when item is
	not of the correct type.

svn path=/trunk/mcs/; revision=73976
2007-03-09 00:38:11 +00:00
Gert Driesen dfdbcf7fdd * Comparer.cs: Renamed IComparableOfTComparer<T> to GenericComparer<T>
to fix binary serialization compatibility with MS.
* ComparerTest.cs: Added test for bug #80929. Added tests to verify
binary serialization compatibility.
* IListTest.cs: Fixed header.
* corlib_test.dll.sources: Added ComparerTest.cs.

svn path=/trunk/mcs/; revision=73964
2007-03-08 20:22:06 +00:00
Gert Driesen d2b7b476e7 * corlib_test.dll.sources: Added IListTest.cs.
* IListTest.cs: Added test for bug #80260.

svn path=/trunk/mcs/; revision=73900
2007-03-07 19:08:24 +00:00
Miguel de Icaza 0d7f04e0e4 2007-03-05 David Mitchell <[email protected]>
* Dictionary.cs: An instance of Dictionary<TKey,TValue> is
	supposed to throw a KeyNotFoundException when 
	the user attempts to retrieve the value associated with a key that
	is not in the dictionary.

	On the other hand, an instance of IDictionary is supposed to
	return null in similar circumstances.


svn path=/trunk/mcs/; revision=73764
2007-03-05 21:56:00 +00:00
Miguel de Icaza 9ea62353d8 2007-03-05 David Mitchell <[email protected]>
* List.cs: Fix InsertRange bug (80930).


svn path=/trunk/mcs/; revision=73762
2007-03-05 21:34:23 +00:00
Gert Driesen a22cecf689 * List.cs: Fixed binary serialization compatibility with MS.NET.
Increment version whenever _items is modified; this fixes version
checks in Enumerator.
* ListTest.cs: Added tests for binary serialization, and Enumerator
version checks.

svn path=/trunk/mcs/; revision=66698
2006-10-15 14:17:58 +00:00
Atsushi Eno 089398a170 2006-05-08 Atsushi Enomoto <[email protected]>
* ArrayTest.cs : use proper comparer in IndexOf() and LastIndexOf().
	  Patch by Kazuki Oikawa. Fixed bug #77277.

	* List.cs : use proper comparer in Contains(), IndexOf() and
	  LastIndexOf(). Patch by Kazuki Oikawa. Fixed bug #77277.

	* ArrayTest.cs : test for bug #77277 by Kazuki Oikawa.

	* ListTest.cs : test for bug #77277 by Kazuki Oikawa.


svn path=/trunk/mcs/; revision=60396
2006-05-08 07:34:06 +00:00
Ankit Jain bff6e6ed35 In class/corlib/System.Collections.Generic:
* List.cs (CheckIndex): Check for -ve indices and allow index == size.
	(Insert): Use CheckIndex.

In class/corlib/Test/System.Collections.Generic:

	* ListTest.cs: Add some tests for InsertRange.


svn path=/trunk/mcs/; revision=58069
2006-03-16 17:04:44 +00:00
Raja R Harinath ae6559b8ab In System.Collections.Generic:
Speed up remove.  Use 'dict[k]=v' as a self-tuning hint.
	* Dictionary.cs (GetSlot): Move data-structure traversal to ...
	(GetPrev): ... this.  Returns the slot prior to the place we're
	looking for, or null if that place is the head of the chain.
	(Remove): Use it.
	(this.set): Use it.  Implement move-to-front on set.

	* Dictionary.cs (ToTKey, ToTValue): New helpers to convert from
	type 'object'.
	(IDictionary.this, IDictionary.Add): Use them.
	(IDictionary.Contains, IDictionary.Remove): If the types don't
	match, do nothing.

In Test/System.Collections.Generic:
	* DictionaryTest.cs (IDictionary_*): Add a few tests for the
	IDictionary explicit implementation.

svn path=/trunk/mcs/; revision=55946
2006-01-23 15:21:09 +00:00