Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : QYVORA7// File : Tests/QyvoraQuantumShieldTests/AuditRegressionTests.swift8// Module : Tests9// Repository : https://git.spboucher.ai/qyvora10// Project Website : Not specified11// Created : 2026-12-0412// Last Modified : 2026-12-0413//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : None specified (no license file in this repository)33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation42import Testing43import QyvoraVault44@testable import QyvoraQuantumShield4546/// Regression test of the security audit (finding QYV-SVC-006): durations taken from the stored profile were47/// converted with `Int(Double)`, which traps on values outside the range of Int. They are now bounded.48@Suite struct ShieldAuditRegressionTests {49 @Test func extremeDurationsInTheProfileDoNotTrapTheReport() async throws {50 let report = try await QuantumShieldTests.vaultReport()51 for seconds in [1e300, Double.greatestFiniteMagnitude, .infinity, 901, 3_600] {52 let section = QuantumShield.vaultSecurity(QuantumShieldTests.vaultInput(report, autoLock: .after(seconds: seconds)))53 #expect(section.findings.contains { $0.id == "vault.autolock.long" })54 }55 for seconds in [-1e300, -.infinity, .nan, 0, 60, 900] {56 let section = QuantumShield.vaultSecurity(QuantumShieldTests.vaultInput(report, autoLock: .after(seconds: seconds)))57 #expect(section.findings.contains { $0.id == "vault.autolock.ok" })58 }59 // a backup date absurdly far in the past or in the future60 for backup in [Date(timeIntervalSince1970: -1e300), Date(timeIntervalSince1970: 1e300), Date.distantPast, Date.distantFuture] {61 let section = QuantumShield.vaultSecurity(QuantumShieldTests.vaultInput(report, backup: backup))62 #expect(section.findings.contains { $0.id == "vault.backup.old" || $0.id == "vault.backup.recent" })63 }64 }65}66