Skip to content

Commit

Permalink
Add testCase for findKeys()
Browse files Browse the repository at this point in the history
  • Loading branch information
sabinbajracharya authored and Lex Sapkota committed May 10, 2018
1 parent b3ee65e commit 35961ef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions SwiftStoreTests/SwiftStoreTests.swift
Expand Up @@ -98,6 +98,21 @@ class SwiftStoreTests: XCTestCase {


}

func testFindKeys() {
// test non-existent key
XCTAssertEqual(store.findKeys(key: "r0").count, 0, "Length of r0 should be 0.")
for i in (0 ..< 10) {
let key = "r1-\(i)"
store[key] = "r1-\(i)"
}
for i in (0 ..< 20) {
let key = "r2-\(i)"
store[key] = "r2-\(i)"
}
XCTAssertEqual(store.findKeys(key: "r1").count, 10, "Length of r1 should be 10.")
XCTAssertEqual(store.findKeys(key: "r2").count, 20, "Length of r2 should be 20.")
}

override func tearDown() {
store.close()
Expand Down

0 comments on commit 35961ef

Please sign in to comment.