25 lines
814 B
Swift
25 lines
814 B
Swift
//
|
|
// SemiCaseSensitiveComparatorTests.swift
|
|
// TuskerTests
|
|
//
|
|
// Created by Shadowfacts on 12/1/22.
|
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import Tusker
|
|
|
|
final class SemiCaseSensitiveComparatorTests: XCTestCase {
|
|
|
|
func testCompare() {
|
|
let comparator = SemiCaseSensitiveComparator()
|
|
XCTAssertEqual(comparator.compare("a", "a"), .orderedSame)
|
|
XCTAssertEqual(comparator.compare("a", "A"), .orderedAscending)
|
|
XCTAssertEqual(comparator.compare("A", "a"), .orderedDescending)
|
|
XCTAssertEqual(comparator.compare("a", "B"), .orderedAscending)
|
|
XCTAssertEqual(comparator.compare("b", "A"), .orderedDescending)
|
|
XCTAssertEqual(["TEST", "Test", "test"].sorted(using: comparator), ["test", "Test", "TEST"])
|
|
}
|
|
|
|
}
|