(library
 (name test_common)
 (libraries mirage-crypto ounit2 ohex)
 (modules test_common)
 (optional))

(test
 (name test_symmetric_runner)
 (libraries test_common mirage-crypto ounit2)
 (package mirage-crypto)
 (modules test_base test_cipher test_symmetric_runner))

(test
 (name test_random_runner)
 (libraries test_common mirage-crypto mirage-crypto-rng mirage-crypto-rng.unix
   randomconv ounit2)
 (package mirage-crypto-rng)
 (modules test_random_runner))

(test
 (name test_pk_runner)
 (libraries test_common mirage-crypto-pk mirage-crypto-rng.unix randomconv
   ounit2)
 (package mirage-crypto-pk)
 (modules test_numeric test_dh test_dsa test_rsa test_pk_runner))

(test
 (name test_entropy_collection)
 (modules test_entropy_collection)
 (package mirage-crypto-rng-mirage)
 (libraries mirage-crypto-rng-mirage mirage-unix duration ohex))

(test
 (name test_entropy)
 (modules test_entropy)
 (package mirage-crypto-rng)
 (libraries mirage-crypto-rng ohex)
 (enabled_if (and (<> %{architecture} "arm64") (<> %{architecture} "riscv64"))))
 ; see https://github.com/mirage/mirage-crypto/issues/216

(test
 (name test_ec)
 (modules test_ec)
 (libraries test_common alcotest mirage-crypto-ec mirage-crypto-rng.unix)
 (package mirage-crypto-ec))

(test
 (name test_ec_wycheproof)
 (modules test_ec_wycheproof)
 (deps ecdh_secp256r1_test.json ecdsa_secp256r1_sha256_test.json
   ecdsa_secp256r1_sha512_test.json ecdh_secp384r1_test.json
   ecdsa_secp384r1_sha384_test.json ecdsa_secp384r1_sha512_test.json
   ecdh_secp521r1_test.json ecdsa_secp521r1_sha512_test.json
   x25519_test.json eddsa_test.json)
 (libraries alcotest mirage-crypto-ec wycheproof digestif asn1-combinators)
 (package mirage-crypto-ec))

(tests
 (names     test_miou_rng test_miou_entropy_collection)
 (modules   test_miou_rng test_miou_entropy_collection)
 (libraries mirage-crypto-rng-miou-unix duration ohex)
 (package   mirage-crypto-rng-miou-unix)
 (enabled_if (<> %{os_type} "Win32")))
