Commit Graph
32 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
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 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 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 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
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 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
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
Raja R Harinath 18b3383ec5 In System.Collections.Generic:
Fix to pass new nunit tests.
	* Dictionary.cs (ShimEnumerator): New class.  Implement the
	requirement that ((IDictionary) foo).GetEnumerator ().Current has
	type DictionaryEntry.
	(IDictionary.GetEnumerator): Use ShimEnumerator.
	(Enumerator.Current): Now has type KeyValuePair<TKey, TValue>.
	(Enumerator.MoveNext): Use VerifyState.
	(Enumerator.VerifyState): Move validation of 'current' field to ...
	(Enumerator.CurrentSlot): ... this.
	(Enumerator.Current, Enumerator.IDictionaryEnumerator.Entry):
	Use CurrentSlot.
	(CopyTo, ICollection.CopyTo): Use subtle reasoning to replace a
	'>=' with a '>'.  Don't throw an ArgumentException when
	index==array.Length && Count==0.
	(KeyCollection.CopyTo, ValueCollection.CopyTo): Likewise, and thus
	obviate the need to check (dictionary.Count == 0).

In Test/System.Collections.Generic:
	* DictionaryTest.cs: Remove NotWorking annotations.
	(Empty_CopyTo, Empty_Values_CopyTo): Fix tests to check that
	CopyTo from an empty dictionary does not throw an exception when
	'index==array.Length'.
	(PlainEnumeratorReturnTest): Check the type of 'Entry' property too.

svn path=/trunk/mcs/; revision=55781
2006-01-19 13:32:39 +00:00
Atsushi Eno 80596125e4 2006-01-19 Atsushi Enomoto <[email protected]>
* DictionaryTest.cs : fixed several tests to not fail under .NET 2.0
	  and thus marked some as NotWorking. Numbered some assertions.


svn path=/trunk/mcs/; revision=55774
2006-01-19 09:47:00 +00:00
Sebastien Pouliot 67eebba85b * DictionaryTest.cs: Added test cases for CopyTo, including a test for
DictionaryEntry.
	* ListTest.cs: Added test case for #77019 when copying from an empty 
	dictionary.

2005-12-19  Sebastien Pouliot  <[email protected]>


svn path=/trunk/mcs/; revision=54615
2005-12-19 17:16:52 +00:00
Miguel de Icaza 77f55162b9 Add new test for bug #76061
Fix bug #76061

Change field style


svn path=/trunk/mcs/; revision=50203
2005-09-18 22:44:30 +00:00
Martin Baulig 12f6496288 2005-08-16 Martin Baulig <[email protected]>
* DictionaryTest.cs (IEnumeratorGenericTest): Reflect latest
	`KeyValuePair<K,V>' API changes.


svn path=/trunk/mcs/; revision=48429
2005-08-16 14:06:23 +00:00
Raja R Harinath cf760a97e8 In System.Collections.Generic:
Introduce some thread-safety by removing the modify-on-read
	move-to-front heuristic.
	* Dictionary.cs (_enumeratorGeneration, _enumerators): Remove.
	(Count): Add internal property set.  Invalidate enumerators when
	Count is changed.  Change all references of _usedSlots to Count.
	(this): Invalidate enumerators when the value of some slot is
	changed, even if the layout of the data-structure isn't modified.
	(DoHash): Remove null-key check.  All codepaths leading to this
	function already have the check.
	(GetSlot): Remove move-to-front heuristic.
	(Remove): Update.

In Test/System.Collections.Generic:
	* DictionaryTest.cs (FailFastTest1, FailFastTest2, FailFastTest3):
	New tests to ensure that enumerators are invalidated on
	modifications to the dictionary.

svn path=/trunk/mcs/; revision=46538
2005-06-27 08:36:29 +00:00
Raja R Harinath 497020b7ff In System.Collections.Generic:
* Dictionary.cs (_generation, _enumeratorGeneration, _enumerators):
	New fields to implement fail-fast semantics.  All code that
	modifies the table increment _generation.
	(GetSlot): Use _hcp to compare keys.  Return the slot containing
	the key, rather than the index.  Avoid move-to-front heuristic
	when there's an enumerator coursing through the table.
	(this, Add, TryGetValue, ContainsKey, Remove): Update to change.
	(Enumerator.Enumerator): Save the generation of the dictionary.
	(Enumerator.Dispose): Inform dictionary that the enumerator is no more.
	(Enumerator.MoveNext, Enumerator.VerifyState): Fail if the
	dictionary has been modified.

In Test/System.Collections.Generic:
	* DictionaryTest.cs (KeyValueEnumeratorTest): Add test for infloop
	if dictionary is read while it's being enumerated.

svn path=/trunk/mcs/; revision=46370
2005-06-22 14:42:13 +00:00
David Waite 7bb5e539d1 2005-06-16 David Waite <[email protected]>
* Dictionary.cs (EnumerationMode): Remove.
    (Enumerator): Remove return type flag - legacy return is expected to
    always return a DictionaryEntry
    (Enumerator): Make constructor internal, it is not public on ms.net 
    beta 2
    (Enumerator.MoveNext): Fix endless loop on enumerator use
    (VerifyState): Added method to check state preconditions and throw
    appropriate exceptions.
    (KeyCollection,ValueCollection): Mark sealed to match ms.net beta 2
    (KeyCollection.Enumerator._hostEnumerator): make exact struct type,
    rather than boxing and using by interface
    (KeyCollection.Enumerator.Dispose): use default to clear Enumerator
    (ValueCollection.Enumerator._hostEnumerator): make exact struct type,
    rather than boxing and using by interface
    (ValueCollection.Enumerator.Dispose): use default to clear Enumerator
    * EqualityComparer.cs (DefaultComparer, IEquatableOfTEqualityComparer):
    Mark as serializable.
    * DictionaryTest.cs (AddTest3): Added test of simple interaction with
    struct dictionary
    (AddDuplicateTest,IndexerGetNullTest,IndexerSetNullTest): Added tests
    for exceptional cases to verify correct exceptions
    (TryGetValueTest): check return value from TryGetValue
    (KeyValueEnumeratorTest): Added test from verification of ms.net beta2
    behavior for non-generic IEnumerator/IDictionaryEnumerator behavior
    against Dictionary<>
    (SerializationTest): Added test to utilize serialization routines.

svn path=/trunk/mcs/; revision=46200
2005-06-19 02:36:21 +00:00
Raja R Harinath 3bb11dfff8 In System.Collections.Generic:
* Dictionary.cs (GetKeys, GetValues): Remove.
	(SetThreshold): New function to calculate the resize threshold.
	(CopyTo): Don't use foreach syntax.
	(ContainsValue): Likewise.  Use default equality comparer of the
	value type.
	(GetObjectData): Use CopyTo to copy into temporary array.  Don't
	save redundant _usedSlots and _threshold.
	(OnDeserialization): Rewrite.
	(ICollection<>.CopyTo): Forward to CopyTo.
	(Enumerator._nextIndex): Rename to from _index.
	(Enumerator._next, Enumerator.FixNext): Remove.
	(Enumerator.Current): Rewrite to avoid need for _next.
	(Enumerator.IEnumerator.Reset): Update.
	(KeyCollection): Is also IEnumerable<TKey> and IEnumerable.
	Update methods to conform to standard.
	(KeyCollection.GetEnumerator): Restore.  Return the correct type.
	(KeyCollection.Enumerator): Rename from KeyEnumerator.  Simple
	wrapper that forwards to Dictionary<,>.Enumerator.
	(ValueCollection): Likewise.

In Test/System.Collections.Generic:
	* DictionaryTest.cs (SliceCollectionsEnumeratorTest): New test
	based on #75053.

svn path=/trunk/mcs/; revision=46087
2005-06-16 12:45:33 +00:00
Ankit Jain 278885d5ba 2005-06-07 Ankit Jain <[email protected]>
* DictionaryTest.cs (KeyValueEnumeratorTest): Added new test.
	

svn path=/trunk/mcs/; revision=45604
2005-06-07 22:31:45 +00:00
Raja R Harinath 59580fe54f * DictionaryTest.cs (MyTest.GetHashCode): Add to silence a compiler warning.
svn path=/trunk/mcs/; revision=44065
2005-05-05 08:53:34 +00:00
Raja R Harinath 87da49f1b0 In System.Collections.Generic:
* Dictionary.cs: Update to draft of Feb 27.  Add some argument checks.
	(GetSlot): Don't throw KeyNotFoundException.  Unify all list
	traversals in here.  Move found key to head of chain, and return
	the index of the chain suitable for/containing the key.
	(Item, Add, Remove): Simplify, and remove FIXMEs.
	(Resize): Reuse linked list nodes from old table.

In Test/System.Collections.Generic:
	* DictionaryTest.cs: Update.

svn path=/trunk/mcs/; revision=42508
2005-04-04 10:48:49 +00:00
Ben Maurer 834984e9d8 In .:
2005-04-02  Ben Maurer  <[email protected]>

	* corlib_test.dll.sources: Add new test.

In Test/System.Collections.Generic:
2005-04-02  Ben Maurer  <[email protected]>

	* DictionaryTest.cs: new test.


svn path=/trunk/mcs/; revision=42491
2005-04-02 19:44:08 +00:00