Overview
Comment: | Never rely on messing with OFHashSeed in tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
a58692ecce7e3c4dd0a40a70a2e0604d |
User & Date: | js on 2024-02-12 20:10:19 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-12
| ||
21:31 | Migrate OFSetTests to ObjFWTest check-in: a7780ddefc user: js tags: objfwtest | |
20:10 | Never rely on messing with OFHashSeed in tests check-in: a58692ecce user: js tags: objfwtest | |
2024-02-11
| ||
22:32 | Migrate OFINIFileTests to ObjFWTest check-in: cc7c76d3c2 user: js tags: objfwtest | |
Changes
Modified new_tests/OFArrayTests.h from [418a1a5a2c] to [8f8b5c5038].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #import "ObjFWTest.h" @interface OFArrayTests: OTTestCase { OFArray *_array; } | | | 17 18 19 20 21 22 23 24 25 | #import "ObjFWTest.h" @interface OFArrayTests: OTTestCase { OFArray *_array; } @property (readonly, nonatomic) Class arrayClass; @end |
Modified new_tests/OFJSONTests.m from [125230cf82] to [fbfa925551].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFJSONTests: OTTestCase { | < < < < < < < < < < < < < | > > > | > > | | > > > | > > > | | > > > | > > | 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFJSONTests: OTTestCase { OFDictionary *_dictionary; } @end static OFString *string = @"{\"foo\"\t:'b\\na\\r', \"x\":/*foo*/ [.5\r,0xF," @"null//bar\n,\"foo\",false]}"; @implementation OFJSONTests - (void)setUp { [super setUp]; _dictionary = [[OFDictionary alloc] initWithKeysAndObjects: @"foo", @"b\na\r", @"x", [OFArray arrayWithObjects: [OFNumber numberWithFloat: .5f], [OFNumber numberWithInt: 0xF], [OFNull null], @"foo", [OFNumber numberWithBool: false], nil], nil]; } - (void)dealloc { [_dictionary release]; [super dealloc]; } - (void)testObjectByParsingJSON { OTAssertEqualObjects(string.objectByParsingJSON, _dictionary); } - (void)testJSONRepresentation { OFString *representation = _dictionary.JSONRepresentation; OTAssert( [representation isEqual: @"{\"x\":[0.5,15,null,\"foo\",false],\"foo\":\"b\\na\\r\"}"] || [representation isEqual: @"{\"foo\":\"b\\na\\r\",\"x\":[0.5,15,null,\"foo\",false]}"]); } - (void)testPrettyJSONRepresentation { OFString *representation = [_dictionary JSONRepresentationWithOptions: OFJSONRepresentationOptionPretty]; OTAssert( [representation isEqual: @"{\n\t\"x\": [\n\t\t0.5,\n\t\t15,\n\t\tnull,\n\t\t" @"\"foo\",\n\t\tfalse\n\t],\n\t\"foo\": \"b\\na\\r\"\n}"] || [representation isEqual: @"{\n\t\"foo\": \"b\\na\\r\",\n\t\"x\": [\n\t\t0.5,\n\t\t15," @"\n\t\tnull,\n\t\t\"foo\",\n\t\tfalse\n\t]\n}"]); } - (void)testJSON5Representation { OFString *representation = [_dictionary JSONRepresentationWithOptions: OFJSONRepresentationOptionJSON5]; OTAssert( [representation isEqual: @"{x:[0.5,15,null,\"foo\",false],foo:\"b\\\na\\r\"}"] || [representation isEqual: @"{foo:\"b\\\na\\r\",x:[0.5,15,null,\"foo\",false]}"]); } - (void)testObjectByParsingJSONFailsWithInvalidJSON { OTAssertThrowsSpecific([@"{" objectByParsingJSON], OFInvalidJSONException); |
︙ | ︙ |
Modified new_tests/OFNumberTests.m from [03fbf0fe79] to [79e5b7d8e7].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 | #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFNumberTests: OTTestCase @end | > > > > > > > | > | | | > | > > > > > | < < < < | < < < > < | < | | 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 58 59 60 61 62 63 64 65 66 67 | #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFNumberTests: OTTestCase { OFNumber *_number; } @end @implementation OFNumberTests - (void)setUp { [super setUp]; _number = [[OFNumber alloc] initWithLongLong: 123456789]; } - (void)dealloc { [_number release]; [super dealloc]; } - (void)testIsEqual { OTAssertEqualObjects(_number, [OFNumber numberWithLong: 123456789]); } - (void)testHash { OTAssertEqual(_number.hash, [[OFNumber numberWithLong: 123456789] hash]); } - (void)testCharValue { OTAssertEqual(_number.charValue, 21); } - (void)testDoubleValue { OTAssertEqual(_number.doubleValue, 123456789.L); } - (void)testSignedCharMinAndMaxUnmodified { OTAssertEqual([[OFNumber numberWithChar: SCHAR_MIN] charValue], SCHAR_MIN); OTAssertEqual([[OFNumber numberWithChar: SCHAR_MAX] charValue], |
︙ | ︙ |