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

View file

@ -119,16 +119,16 @@
XCTAssertEqual(messageIndex, 0);
// export the keys
NSString *export = [session1 exportSessionAtMessageIndex:0 error:&error];
NSString *cexport = [session1 exportSessionAtMessageIndex:0 error:&error];
XCTAssertNil(error);
XCTAssertGreaterThan(export.length, 0);
XCTAssertGreaterThan(cexport.length, 0);
// free the old session to check there is no shared data
session1 = nil;
// 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);
XCTAssert(session2);