           knn?.add(data)
           expect(Realm(path: realmPath).objects(Dog).count) == data.count
         }
+
+        it("can search correct label") {
+          for dog in data {
+            let nearestDogs = knn?.search(dog)
+            expect(nearestDogs?.count) == k
+          }
+        }
       }
 
       describe("start from already built realm") {

    beforeEach {
      // set test data to realm
      deleteRealmFilesAtPath(realmPath)
      knn = kNNRealm<Dog>(realm: Realm(path: realmPath), k: 3, query: query, distance: distance)
    }

    afterEach {

      return dog
    }

    let k = 3

    let query = { (q: Dog, results: Results<Dog>) -> Results<Dog> in
      return results
        .filter("height >= \(q.height - 2)")
        .filter("height <= \(q.height + 2)")
        .filter("weight >= \(q.weight - 2)")
        .filter("weight <= \(q.weight + 2)")
        .filter("bodyLength >= \(q.bodyLength - 2)")
        .filter("bodyLength <= \(q.bodyLength + 2)")
    }

    let distance = { (l: Dog, r: Dog) -> Double in
