mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-23 00:47:31 +09:00
Dactyloidae iOS initial commit
This commit is contained in:
parent
daa6179d22
commit
7154a0497e
2123 changed files with 197052 additions and 0 deletions
56
mobile/ios/SyncTests/InfoTests.swift
Normal file
56
mobile/ios/SyncTests/InfoTests.swift
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import Foundation
|
||||
import Shared
|
||||
@testable import Sync
|
||||
|
||||
import XCTest
|
||||
import SwiftyJSON
|
||||
|
||||
class InfoTests: XCTestCase {
|
||||
func testSame() {
|
||||
let empty = JSON(parseJSON: "{}")
|
||||
|
||||
let oneA = JSON(parseJSON: "{\"foo\": 1234.0, \"bar\": 456.12}")
|
||||
let oneB = JSON(parseJSON: "{\"bar\": 456.12, \"foo\": 1234.0}")
|
||||
|
||||
let twoA = JSON(parseJSON: "{\"bar\": 456.12}")
|
||||
let twoB = JSON(parseJSON: "{\"foo\": 1234.0}")
|
||||
|
||||
let iEmpty = InfoCollections.fromJSON(empty)!
|
||||
let iOneA = InfoCollections.fromJSON(oneA)!
|
||||
let iOneB = InfoCollections.fromJSON(oneB)!
|
||||
let iTwoA = InfoCollections.fromJSON(twoA)!
|
||||
let iTwoB = InfoCollections.fromJSON(twoB)!
|
||||
|
||||
XCTAssertTrue(iEmpty.same(iEmpty, collections: nil))
|
||||
XCTAssertTrue(iEmpty.same(iEmpty, collections: []))
|
||||
XCTAssertTrue(iEmpty.same(iEmpty, collections: ["anything"]))
|
||||
|
||||
XCTAssertTrue(iEmpty.same(iOneA, collections: []))
|
||||
XCTAssertTrue(iEmpty.same(iOneA, collections: ["anything"]))
|
||||
XCTAssertTrue(iOneA.same(iEmpty, collections: []))
|
||||
XCTAssertTrue(iOneA.same(iEmpty, collections: ["anything"]))
|
||||
|
||||
XCTAssertFalse(iEmpty.same(iOneA, collections: ["foo"]))
|
||||
XCTAssertFalse(iOneA.same(iEmpty, collections: ["foo"]))
|
||||
XCTAssertFalse(iEmpty.same(iOneA, collections: nil))
|
||||
XCTAssertFalse(iOneA.same(iEmpty, collections: nil))
|
||||
|
||||
XCTAssertTrue(iOneA.same(iOneA, collections: nil))
|
||||
XCTAssertTrue(iOneA.same(iOneA, collections: ["foo", "bar", "baz"]))
|
||||
XCTAssertTrue(iOneA.same(iOneB, collections: ["foo", "bar", "baz"]))
|
||||
XCTAssertTrue(iOneB.same(iOneA, collections: ["foo", "bar", "baz"]))
|
||||
|
||||
XCTAssertFalse(iTwoA.same(iOneA, collections: nil))
|
||||
XCTAssertTrue(iTwoA.same(iOneA, collections: ["bar", "baz"]))
|
||||
XCTAssertTrue(iOneA.same(iTwoA, collections: ["bar", "baz"]))
|
||||
XCTAssertTrue(iTwoB.same(iOneA, collections: ["foo", "baz"]))
|
||||
|
||||
XCTAssertFalse(iTwoA.same(iTwoB, collections: nil))
|
||||
XCTAssertFalse(iTwoA.same(iTwoB, collections: ["foo"]))
|
||||
XCTAssertFalse(iTwoA.same(iTwoB, collections: ["bar"]))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue