blob: 86419a02ce466f44bc332deaf2122fd4d7b275dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// CaseInsensitiveHashCodeProviderTest
using System;
using System.Collections;
using NUnit.Framework;
namespace MonoTests.System.Collections {
/// <summary>CaseInsensitiveHashCodeProvider test suite.</summary>
public class CaseInsensitiveHashCodeProviderTest : TestCase {
public CaseInsensitiveHashCodeProviderTest() : base ("MonoTests.System.Collections.CaseInsensitiveHashCodeProviderTest testcase") {}
public CaseInsensitiveHashCodeProviderTest(String name) : base(name)
{
}
protected override void SetUp ()
{
}
public static ITest Suite
{
get {
return new TestSuite(typeof(CaseInsensitiveHashCodeProviderTest));
}
}
public void TestDefaultInstance ()
{
// Make sure the instance returned by Default
// is really a CaseInsensitiveHashCodeProvider.
Assert((CaseInsensitiveHashCodeProvider.Default
as CaseInsensitiveHashCodeProvider) != null);
}
public void TestHashCode () {
CaseInsensitiveHashCodeProvider cih = new CaseInsensitiveHashCodeProvider ();
int h1 = cih.GetHashCode ("Test String");
int h2 = cih.GetHashCode ("test string");
int h3 = cih.GetHashCode ("TEST STRING");
Assert("Mixed Case != lower case", h1 == h2);
Assert("Mixed Case != UPPER CASE", h1 == h3);
h1 = cih.GetHashCode ("one");
h2 = cih.GetHashCode ("another");
// Actually this is quite possible.
Assert(h1 != h2);
}
}
}
|