From c36d19a0640d74f1d115a3d4dd547540342d8bab Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Tue, 21 May 2024 11:09:20 +0100 Subject: [PATCH] Fix broken DataProtocol.hexString test utility (#230) --- Tests/_CryptoExtrasTests/Utils/BytesUtil.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tests/_CryptoExtrasTests/Utils/BytesUtil.swift b/Tests/_CryptoExtrasTests/Utils/BytesUtil.swift index a01b0db9..dfbf64e8 100644 --- a/Tests/_CryptoExtrasTests/Utils/BytesUtil.swift +++ b/Tests/_CryptoExtrasTests/Utils/BytesUtil.swift @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// import Foundation +import XCTest enum ByteHexEncodingErrors: Error { case incorrectHexValue @@ -70,7 +71,7 @@ extension DataProtocol { offset += 1 } } - count = offset + count = offset * 2 } return String(decoding: bytes, as: UTF8.self) } @@ -100,3 +101,9 @@ extension Data { } } + +final class BytesUtilTests: XCTestCase { + func testHexStringUtils() throws { + XCTAssertEqual(try Data(hexString: "deadbeef").hexString, "deadbeef") + } +}