Added: test cases for ’intValue’ and ’integerValue’ methods on CPString and CPNumber

This commit is contained in:
Martin Carlberg committed 2016-03-23 09:02:09 +01:00
1 parent 7780a98abe
commit 111b12161c
2 files changed
+38

No files matched your search

+19
View File
@@ -12,4 +12,23 @@
[self assertThrows:function () { [34 compare:[CPNull null]] }];
}
- (void)testintValue
{
var testStrings = [
[090, 90],
[-1, -1],
[3.1415, 3],
[2.7183, 2],
[-0, 0],
[00, 0],
[-00, 0],
[+001, 1],
];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] intValue] equals:testStrings[i][1]];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] integerValue] equals:testStrings[i][1]];
}
@end
+19
View File
@@ -165,6 +165,25 @@
[self assert:[testStrings[i][0] boolValue] equals:testStrings[i][1]];
}
- (void)testintValue
{
var testStrings = [
[" 090", 90],
[" -1", -1],
[" 3.1415", 3],
[" 2.7183", 2],
[" -0", 0],
[" 00", 0],
[" -00", 0],
[" +001", 1],
];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] intValue] equals:testStrings[i][1]];
for (var i = 0; i < testStrings.length; i++)
[self assert:[testStrings[i][0] integerValue] equals:testStrings[i][1]];
}
- (void)testCommonPrefixWithString
{
var testStringsCase = [