testing some ways to make querying as elegant as possible

This commit is contained in:
John Rommel Estropia
2014-12-13 10:06:16 +09:00
parent 8010daa161
commit 45a65d9262
12 changed files with 604 additions and 175 deletions

View File

@@ -2,12 +2,30 @@
// HardcoreDataTests.swift
// HardcoreDataTests
//
// Created by John Rommel Estropia on 2014/09/14.
// Copyright (c) 2014 John Rommel Estropia. All rights reserved.
// Copyright (c) 2014 John Rommel Estropia
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import UIKit
import XCTest
import HardcoreData
class HardcoreDataTests: XCTestCase {
@@ -23,7 +41,7 @@ class HardcoreDataTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
NSLog("Test aaaa")
#if DEBUG
let resetStoreOnMigrationFailure = true
#else
@@ -43,15 +61,18 @@ class HardcoreDataTests: XCTestCase {
HardcoreData.performTransaction { (transaction) -> () in
let obj = transaction.context.findFirst(FlickrPhoto)
let obj = transaction.findFirst(
TestEntity1
.WHERE(true)
.SORTEDBY(.Ascending("testEntityID"), .Descending("testString")))
transaction.commit { (result) -> () in
switch result {
case .Success(let hasChanges):
JEDump(hasChanges, "hasChanges")
dump(hasChanges, name: "hasChanges")
case .Failure(let error):
JEDump(error, "error")
dump(error, name: "error")
}
}
}