// Example of setting up integration tests for a CryptoKit-based hashing function
import XCTest
import CryptoKit
class CryptoKitIntegrationTests: XCTestCase {
func testSHA256Hash() {
let input = "Hello, World!"
let inputData = Data(input.utf8)
// Perform SHA256 hashing using CryptoKit
let hashed = SHA256.hash(data: inputData)
// Expected SHA256 hash value for "Hello, World!"
let expectedHash = "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda190f7c6c9b2d95d7f8c"
// Convert hashed result to a hex string
let hashedHexString = hashed.compactMap { String(format: "%02x", $0) }.joined()
// Assert that the hashed output matches the expected hash
XCTAssertEqual(hashedHexString, expectedHash, "SHA256 hashing failed")
}
}
How do I avoid rehashing overhead with std::set in multithreaded code?
How do I find elements with custom comparators with std::set for embedded targets?
How do I erase elements while iterating with std::set for embedded targets?
How do I provide stable iteration order with std::unordered_map for large datasets?
How do I reserve capacity ahead of time with std::unordered_map for large datasets?
How do I erase elements while iterating with std::unordered_map in multithreaded code?
How do I provide stable iteration order with std::map for embedded targets?
How do I provide stable iteration order with std::map in multithreaded code?
How do I avoid rehashing overhead with std::map in performance-sensitive code?
How do I merge two containers efficiently with std::map for embedded targets?