mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-24 23:45:52 +00:00
Added: test cases for ’intValue’ and ’integerValue’ methods on CPString and CPNumber
This commit is contained in:
1 parent
7780a98abe
commit
111b12161c
2 files changed
+38
No files matched your search
@@ -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
|
||||
@@ -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 = [
|
||||
|
||||
Reference in new issue
Block a user