Skip to content

Commit

Permalink
fixed code coverage and access
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Nov 11, 2018
1 parent f879247 commit ba95988
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Sources/Base32Crockford/Array.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension Array where Element : FixedWidthInteger {
}

#if DEBUG
public static func debugRandom(withCount count: Int, in range: ClosedRange<Element>? = nil, fatalError: ((String?) -> Void)? = nil) -> Array? {
internal static func debugRandom(withCount count: Int, in range: ClosedRange<Element>? = nil, fatalError: ((String?) -> Void)? = nil) -> Array? {
return self.random(withCount: count, in: range, fatalError: fatalError)
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Sources/Base32Crockford/Base32CrockfordGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ extension Base32CrockfordEncodingProtocol {
}

#if DEBUG
public func debugGenerate(_ count: Int, from identifierDataType: IdentifierDataType, fatalError: ((String?) -> Void)? = nil) -> [String]? {
internal func debugGenerate(_ count: Int, from identifierDataType: IdentifierDataType, fatalError: ((String?) -> Void)? = nil) -> [String]? {
return self.generate(count, from: identifierDataType, fatalError: fatalError)
}

public func debugGenerateIdentifier(from identifierDataType: IdentifierDataType, fatalError: ((String?) -> Void)? = nil) -> String? {
internal func debugGenerateIdentifier(from identifierDataType: IdentifierDataType, fatalError: ((String?) -> Void)? = nil) -> String? {
return self.generateIdentifier(from: identifierDataType, fatalError: fatalError)
}
#endif
Expand Down
25 changes: 0 additions & 25 deletions Sources/Base32Crockford/Binary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ public struct Binary {
return Int(self.bytes[position])
}

// public func bytes(_ start: Int, _ length: Int) -> [UInt8] {
// return Array(self.bytes[start..<start+length])
// }
//
// public func bytes(_ start: Int, _ length: Int) -> Int {
// return bits(start*self.byteSize, length*self.byteSize)
// }

public func bitsWithInternalOffsetAvailable(_ length: Int) -> Bool {
return (self.bytes.count * self.byteSize) >= (self.readingOffset + length)
}
Expand All @@ -61,21 +53,4 @@ public struct Binary {
return nil
}
}
//
// public func bytesWithInternalOffsetAvailable(_ length: Int) -> Bool {
// let availableBits = self.bytes.count * self.byteSize
// let requestedBits = readingOffset + (length * self.byteSize)
// let possible = availableBits >= requestedBits
// return possible
// }

// public mutating func next(bytes length: Int) -> [UInt8] {
// if bytesWithInternalOffsetAvailable(length) {
// let returnValue = self.bytes[(self.readingOffset / self.byteSize)..<((self.readingOffset / self.byteSize) + length)]
// self.readingOffset = self.readingOffset + (length * self.byteSize)
// return Array(returnValue)
// } else {
// fatalError("Couldn't extract Bytes.")
// }
// }
}
48 changes: 0 additions & 48 deletions Sources/Base32Crockford/FatalError.swift

This file was deleted.

11 changes: 1 addition & 10 deletions Sources/Base32Crockford/IdentifierDataType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,7 @@ extension IdentifierDataType : Codable {
}

}

let isDefault = try? decoder.singleValueContainer().decodeNil()

if isDefault == true {
self = .default
return
} else {
throw InvalidIdentifierDataTypeError()
}

throw InvalidIdentifierDataTypeError()
}

public func encode(to encoder: Encoder) throws {
Expand Down

0 comments on commit ba95988

Please sign in to comment.