<commit_before>import XCTest
@testable import JWT

class JWSTests: XCTestCase {
    func testBasics() throws {
        let secret = Data("aaaaaaaabvbcas".utf8)
        
        let signature = try JSONWebSignature(headers: [.hs256()], payload: AuthenticationMessage(token: "test"), secret: secret).sign()
        
        let decoded = try JSONWebSignature<AuthenticationMessage>(from: signature, verifyingWith: secret)
        XCTAssertEqual(decoded.payload.token, "test")
    }
    
    static var allTests: [(String, (JWSTests) -> () throws -> Void)] = [
        ("testBasics", testBasics),
        ]
}

struct AuthenticationMessage : Codable {
    var token: String
}<commit_msg>Test failure<commit_after>import XCTest
@testable import JWT

class JWSTests: XCTestCase {
    func testBasics() throws {
        let secret = Data("aaaaaaaabvbcas".utf8)
        
        let signature = try JSONWebSignature(headers: [.hs256()], payload: AuthenticationMessage(token: "test"), secret: secret).sign()
        
        let decoded = try JSONWebSignature<AuthenticationMessage>(from: signature, verifyingWith: secret)
        XCTAssertEqual(decoded.payload.token, "test")
    }
    
    func testInvalidSignature() throws {
        let secret = Data("aaaaaaaabvbcas".utf8)
        
        let signature = try JSONWebSignature(headers: [.hs256()], payload: AuthenticationMessage(token: "test"), secret: secret).sign()
        
        XCTAssertThrowsError(try JSONWebSignature<AuthenticationMessage>(from: signature, verifyingWith: Data("dsadasdsad".utf8)))
    }
    
    static var allTests: [(String, (JWSTests) -> () throws -> Void)] = [
        ("testBasics", testBasics),
    ]
}

struct AuthenticationMessage : Codable {
    var token: String
}
{'fraction_non_alphanumeric': 0.11734401831711505, 'fraction_numerical': 0.007441327990841442, 'mean_word_length': 3.37, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4894248', 'n_tokens_mistral': 521, 'n_tokens_neox': 502, 'n_words': 118}