Skip to content

Commit

Permalink
2004-05-30 Sebastien Pouliot <sebastien@ximian.com>
Browse files Browse the repository at this point in the history
	* ArrayTest.cs: Added tests for null values in BinarySearch.
	* Byte.cs: Added test for default ToString format value.

svn path=/trunk/mcs/; revision=28598
  • Loading branch information
Sebastien Pouliot committed Jun 1, 2004
1 parent f82a1f8 commit de8ffd3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mcs/class/corlib/Test/System/ArrayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ public void TestBinarySearch3()
AssertEquals("#B30", 49, Array.BinarySearch(array, 10));
}

[Test]
public void BinarySearch_NullValue ()
{
int[] array = new int[1];
AssertEquals ("I=a,o", -1, Array.BinarySearch (array, null));
AssertEquals ("I=a,o,c", -1, Array.BinarySearch (array, null, null));
AssertEquals ("I=a,i,i,o", -1, Array.BinarySearch (array, 0, 1, null));
AssertEquals ("I=a,i,i,o,c", -1, Array.BinarySearch (array, 0, 1, null,null));

object[] o = new object [3] { this, this, null };
AssertEquals ("O=a,o", -1, Array.BinarySearch (array, null));
AssertEquals ("O=a,o,c", -1, Array.BinarySearch (array, null, null));
AssertEquals ("O=a,i,i,o", -1, Array.BinarySearch (array, 0, 3, null));
AssertEquals ("O=a,i,i,o,c", -1, Array.BinarySearch (array, 0, 3, null, null));
}

// TODO - testBinarySearch with explicit IComparer args

[Test]
Expand Down
11 changes: 11 additions & 0 deletions mcs/class/corlib/Test/System/ByteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ public void TestToString()
}

}

[Test]
public void ToString_Default ()
{
byte value = 255;
string def = value.ToString ("G");
string format = null;
AssertEquals ("null", def, value.ToString (format));
format = String.Empty;
AssertEquals ("empty", def, value.ToString (format));
}
}

}
5 changes: 5 additions & 0 deletions mcs/class/corlib/Test/System/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2004-05-30 Sebastien Pouliot <sebastien@ximian.com>

* ArrayTest.cs: Added tests for null values in BinarySearch.
* Byte.cs: Added test for default ToString format value.

2004-05-30 David Sheldon <dave-mono@earth.li>

* DecimalTest.cs: Moved the rounding test that fails due to
Expand Down

0 comments on commit de8ffd3

Please sign in to comment.