forked from isair/JSONHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringTests.swift
More file actions
42 lines (34 loc) · 945 Bytes
/
StringTests.swift
File metadata and controls
42 lines (34 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// StringTests.swift
// JSONHelper
//
// Created by Baris Sencan on 6/22/15.
// Copyright (c) 2015 Baris Sencan. All rights reserved.
//
import Foundation
import XCTest
import JSONHelper
class StringTests: XCTestCase {
let testString = "test"
let testIntAndResult = (1, "1")
let testDateAndResult = (Date(timeIntervalSince1970: 0), "1970-01-01")
let testDateFormat = "yyyy-MM-dd"
var value = ""
override func setUp() {
value = ""
}
func testStringConversion() {
value <-- (testString as Any)
XCTAssertEqual(value, testString)
}
func testIntConversion() {
value <-- (testIntAndResult.0 as Any)
XCTAssertEqual(value, testIntAndResult.1)
}
func testDateConversion() {
JSONHelper.dateFormatter.dateFormat = testDateFormat
JSONHelper.dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
value <-- (testDateAndResult.0 as Any)
XCTAssertEqual(value, testDateAndResult.1)
}
}