Files
purchases-ios/Tests/UnitTests/LocalReceiptParsing/DataConverters/ArraySlice_UInt8+ExtensionsTests.swift
T
NachoSoto c987f10266 Created TestCase superclass to allow re-generating snapshots (#1559)
## Motivation:

There is no way to run code statically like in Obj-C using `+ [NSObject initialize]`, so this ensures (through a new `SwiftLint` rule) that all test classes inherit this common test class instead of `XCTestCase` directly.
A future PR will make use of this new `CIRCLECI_TESTS_GENERATE_SNAPSHOTS` environment variable to allow regenerating snapshots in CI.

I've also moved the duplicated `CurrentTestCaseTracker` usages to a single point.
2022-05-10 12:40:40 -07:00

18 lines
544 B
Swift

import Nimble
import XCTest
@testable import RevenueCat
class ArraySliceUInt8ExtensionsTests: TestCase {
func testToUIntReturnsCorrectValue() {
var arraySlice = ArraySlice([UInt8(0b10000000), UInt8(0b10000000)])
expect(arraySlice.toUInt64()) == 0b10000000_10000000
arraySlice = ArraySlice([UInt8(0b1), UInt8(0b01), UInt8(0b10)])
expect(arraySlice.toUInt64()) == 0b00000001_00000001_00000010
arraySlice = ArraySlice([UInt8(0b10010100)])
expect(arraySlice.toUInt64()) == 0b10010100
}
}