@@ -16,6 +16,7 @@ class DirectBindingsAppTests: XCTestCase {
16
16
17
17
override func setUpWithError( ) throws {
18
18
// Put setup code here. This method is called before the invocation of each test method in the class.
19
+ Bindings . setLogThreshold ( severity: . DEBUG)
19
20
}
20
21
21
22
override func tearDownWithError( ) throws {
@@ -25,11 +26,15 @@ class DirectBindingsAppTests: XCTestCase {
25
26
func testExample( ) throws {
26
27
// This is an example of a functional test case.
27
28
// Use XCTAssert and related functions to verify your tests produce the correct results.
28
-
29
+ }
29
30
31
+ func testVersionSanity( ) throws {
32
+ check_get_ldk_version ( )
33
+ check_get_ldk_bindings_version ( )
34
+ check_platform ( )
30
35
}
31
-
32
- func testMemoryLeaksIncrementally ( ) throws {
36
+
37
+ private func incrementalMemoryLeakTest ( ) throws {
33
38
let filter = TestFilter ( )
34
39
let broadcaster = TestBroadcasterInterface ( )
35
40
let logger = TestLogger ( )
@@ -52,10 +57,6 @@ class DirectBindingsAppTests: XCTestCase {
52
57
let serializedChannelMonitors : [ [ UInt8 ] ] = LDKTestFixtures . serializedChannelMonitors
53
58
54
59
var monitors : [ LDKChannelMonitor ] = [ ]
55
- // let secondConfig = config.clone()
56
- // let res = UtilMethods.constructor_BlockHashChannelManagerZ_read(ser: serialized_channel_manager, arg_keys_manager: keysInterface, arg_fee_estimator: feeEstimator, arg_chain_monitor: chainMonitor.as_Watch(), arg_tx_broadcaster: broadcaster, arg_logger: logger, arg_default_config: config, arg_channel_monitors: monitors)
57
-
58
- print ( " last statement in memory leak test " )
59
60
60
61
let channel_manager_constructor = try ChannelManagerConstructor (
61
62
channel_manager_serialized: serialized_channel_manager,
@@ -68,14 +69,19 @@ class DirectBindingsAppTests: XCTestCase {
68
69
tx_broadcaster: broadcaster,
69
70
logger: logger
70
71
)
71
-
72
- var channel_manager = channel_manager_constructor. channelManager;
73
- var cmPersister = TestChannelManagerPersister ( channelManager: channel_manager)
72
+
73
+ let channel_manager = channel_manager_constructor. channelManager;
74
+ let cmPersister = TestChannelManagerPersister ( channelManager: channel_manager)
75
+
74
76
channel_manager_constructor. chain_sync_completed ( persister: cmPersister)
75
77
channel_manager_constructor. interrupt ( )
76
78
}
77
-
78
- func testExtendedActivity( ) {
79
+
80
+ func testMemoryLeaksIncrementally( ) throws {
81
+ try incrementalMemoryLeakTest ( )
82
+ }
83
+
84
+ func testExtendedActivity( ) throws {
79
85
// for i in 0...(1 << 7) {
80
86
for i in 0 ..< 1 { // only do one test run initially
81
87
let nice_close = ( i & ( 1 << 0 ) ) != 0 ;
@@ -97,17 +103,9 @@ class DirectBindingsAppTests: XCTestCase {
97
103
}
98
104
99
105
print ( " Running test with flags \( i) " ) ;
100
- try ? SimulationRunner . do_test ( nice_close: nice_close, use_km_wrapper: use_km_wrapper, use_manual_watch: use_manual_watch, reload_peers: reload_peers, break_cross_peer_refs: break_cross_refs, nio_peer_handler: nio_peer_handler, use_chan_manager_constructor: use_chan_manager_constructor)
106
+ try SimulationRunner . do_test ( nice_close: nice_close, use_km_wrapper: use_km_wrapper, use_manual_watch: use_manual_watch, reload_peers: reload_peers, break_cross_peer_refs: break_cross_refs, nio_peer_handler: nio_peer_handler, use_chan_manager_constructor: use_chan_manager_constructor)
101
107
}
102
108
103
- // avoid early termination
104
-
105
- print ( " Press enter to stop running test. " )
106
- // let keyboard = FileHandle.standardInput
107
- // let inputData = keyboard.availableData
108
- // let strData = String(data: inputData, encoding: String.Encoding.utf8)!
109
-
110
-
111
109
}
112
110
113
111
fileprivate class SimulationRunner {
@@ -132,6 +130,7 @@ class DirectBindingsAppTests: XCTestCase {
132
130
// This is an example of a performance test case.
133
131
self . measure {
134
132
// Put the code you want to measure the time of here.
133
+ // try! incrementalMemoryLeakTest()
135
134
}
136
135
}
137
136
0 commit comments