add_executable (test_cotp test_otp.c)
add_executable (test_base32encode test_base32encode.c)
add_executable (test_base32decode test_base32decode.c)
add_executable (test_base32_roundtrip test_base32_roundtrip.c)
add_executable (test_strerror test_strerror.c)
add_executable (test_otpauth_uri test_otpauth_uri.c)
add_executable (test_secure test_secure.c)
add_executable (test_yaotp test_yaotp.c)
add_executable (test_yaotp_uri test_yaotp_uri.c)

target_link_libraries (test_cotp PRIVATE cotp criterion)
target_link_libraries (test_base32encode PRIVATE cotp criterion)
target_link_libraries (test_base32decode PRIVATE cotp criterion)
target_link_libraries (test_base32_roundtrip PRIVATE cotp criterion)
target_link_libraries (test_strerror PRIVATE cotp criterion)
target_link_libraries (test_otpauth_uri PRIVATE cotp criterion)
target_link_libraries (test_secure PRIVATE cotp criterion)
target_link_libraries (test_yaotp PRIVATE cotp criterion)
target_link_libraries (test_yaotp_uri PRIVATE cotp criterion)

add_test (NAME TestCOTP COMMAND test_cotp)
add_test (NAME TestBase32Encode COMMAND test_base32encode)
add_test (NAME TestBase32Decode COMMAND test_base32decode)
add_test (NAME TestBase32Roundtrip COMMAND test_base32_roundtrip)
add_test (NAME TestStrerror COMMAND test_strerror)
add_test (NAME TestOTPAuthURI COMMAND test_otpauth_uri)
add_test (NAME TestSecure COMMAND test_secure)
add_test (NAME TestYAOTP COMMAND test_yaotp)
add_test (NAME TestYAOTPURI COMMAND test_yaotp_uri)

if (COTP_ENABLE_VALIDATION)
    add_executable (test_validation test_validation.c)
    target_link_libraries (test_validation PRIVATE cotp criterion)
    add_test (NAME TestValidation COMMAND test_validation)
endif()
