Skip to content

Commit

Permalink
Updated version and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apocolipse committed Aug 29, 2018
1 parent 4e1c4c5 commit 55e1f83
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/Thrift.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Thrift {
let version = "0.0.1"
let version = "1.1.0"
}
22 changes: 22 additions & 0 deletions Tests/ThriftTests/TBinaryProtocolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,28 @@ class TBinaryProtocolTests: XCTestCase {
XCTAssertFalse(true, "Caught Error attempting to read \(error)")
}
}
func testUnsafeBitcastUpdate() {
let value: Double = 3.14159
let val: Int64 = 31415926
let uval: UInt64 = 31415926

let i64 = Int64(bitPattern: value.bitPattern)
let ubc = unsafeBitCast(value, to: Int64.self)

XCTAssertEqual(i64, ubc, "Bitcast Double-> i64 Values don't match")

let dbl = Double(bitPattern: UInt64(val))
let ubdb = unsafeBitCast(val, to: Double.self)

XCTAssertEqual(dbl, ubdb, "Bitcast i64 -> Double Values don't match")

let db2 = Double(bitPattern: uval)
let usbc2 = unsafeBitCast(uval, to: Double.self)

XCTAssertEqual(db2, usbc2, "Bitcast u64 -> Double Values don't match")


}

static var allTests : [(String, (TBinaryProtocolTests) -> () throws -> Void)] {
return [
Expand Down
2 changes: 1 addition & 1 deletion Tests/ThriftTests/ThriftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import XCTest

class ThriftTests: XCTestCase {
func testVersion() {
XCTAssertEqual(Thrift().version, "1.0.0")
XCTAssertEqual(Thrift().version, "1.1.0")
}

func test_in_addr_extension() {
Expand Down

0 comments on commit 55e1f83

Please sign in to comment.