Add SPM test target, rename tests to .mm for C++

Doesn't link yet though, need to check why.
This commit is contained in:
Helge Heß 2020-04-10 18:26:43 +02:00
parent 4f2f851762
commit 4c51a48aa7
5 changed files with 21 additions and 13 deletions

View file

@ -17,11 +17,11 @@ let package = Package(
sources: [ "src" ], sources: [ "src" ],
publicHeadersPath: "include", publicHeadersPath: "include",
cSettings: [ cSettings: [
.define("OLMLIB_VERSION_MAJOR", to: String(version.major)), .define("OLMLIB_VERSION_MAJOR", to: String(version.major)),
.define("OLMLIB_VERSION_MINOR", to: String(version.minor)), .define("OLMLIB_VERSION_MINOR", to: String(version.minor)),
.define("OLMLIB_VERSION_PATCH", to: String(version.patch)), .define("OLMLIB_VERSION_PATCH", to: String(version.patch)),
.headerSearchPath("lib"), .headerSearchPath("lib"),
.unsafeFlags([ "-Wall", "-Werror" ]) .unsafeFlags([ "-Wall", "-Werror" ])
] ]
), ),
.target( .target(
@ -32,11 +32,19 @@ let package = Package(
sources: [ "OLMKit" ], sources: [ "OLMKit" ],
publicHeadersPath: "OLMKit", publicHeadersPath: "OLMKit",
cSettings: [ cSettings: [
.headerSearchPath("."), .headerSearchPath("."),
.unsafeFlags([ .unsafeFlags([
"-Wno-unused-command-line-argument", "-Wno-unused-command-line-argument",
"-fmodules", "-fcxx-modules" "-fmodules", "-fcxx-modules"
]) ])
]
),
.testTarget(
name: "OLMKitTests",
dependencies: [ "OLMKit", "libolm" ],
path: "xcode/OLMKitTests",
cSettings: [
.headerSearchPath(".."),
] ]
) )
], ],

View file

@ -119,16 +119,16 @@
XCTAssertEqual(messageIndex, 0); XCTAssertEqual(messageIndex, 0);
// export the keys // export the keys
NSString *export = [session1 exportSessionAtMessageIndex:0 error:&error]; NSString *cexport = [session1 exportSessionAtMessageIndex:0 error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssertGreaterThan(export.length, 0); XCTAssertGreaterThan(cexport.length, 0);
// free the old session to check there is no shared data // free the old session to check there is no shared data
session1 = nil; session1 = nil;
// import the keys into another inbound group session // import the keys into another inbound group session
OLMInboundGroupSession *session2 = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithImportedSession:export error:&error]; OLMInboundGroupSession *session2 = [[OLMInboundGroupSession alloc] initInboundGroupSessionWithImportedSession:cexport error:&error];
XCTAssertNil(error); XCTAssertNil(error);
XCTAssert(session2); XCTAssert(session2);