mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 13:25:41 +02:00
Add parseUInt utility function
There is an increasing number of places where Catch2 wants to parse strings into numbers, but being stuck in C++14 world, we do not have good stdlib facilities to do this (`strtoul` and `stoul` are both bad).
This commit is contained in:
@@ -2383,6 +2383,28 @@ ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !fal
|
||||
ok {test-number} - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false
|
||||
# Parse test names and tags
|
||||
ok {test-number} - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true
|
||||
# Parse uints
|
||||
ok {test-number} - parseUInt( "0" ) == Optional<unsigned int>{ 0 } for: {?} == {?}
|
||||
# Parse uints
|
||||
ok {test-number} - parseUInt( "100" ) == Optional<unsigned int>{ 100 } for: {?} == {?}
|
||||
# Parse uints
|
||||
ok {test-number} - parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } for: {?} == {?}
|
||||
# Parse uints
|
||||
ok {test-number} - parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } for: {?} == {?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "!!KJHF*#" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "-1" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "4294967296" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "42949672964294967296429496729642949672964294967296" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "2 4" )) for: !{?}
|
||||
# Parse uints
|
||||
ok {test-number} - !(parseUInt( "0x<hex digits>", 10 )) for: !{?}
|
||||
# Parsed tags are matched case insensitive
|
||||
ok {test-number} - spec.hasFilters() for: true
|
||||
# Parsed tags are matched case insensitive
|
||||
@@ -4601,5 +4623,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2299
|
||||
1..2310
|
||||
|
||||
|
Reference in New Issue
Block a user