blob: 4a8d1f2aa76f692d2a5b18bd2a0a4bc0ceb457c1 [file] [log] [blame]
Jim Schaad2d883892015-09-01 21:30:49 -07001#
2# Compiling/running tests
3#
4
5if (use_context)
6 add_definitions(-DUSE_CBOR_CONTEXT)
7endif()
8
9set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dist_dir}/test )
10
Jim Schaadc5a5f6b2016-01-09 16:28:26 -080011add_executable ( cose_test test.c json.c encrypt.c sign.c context.c mac_test.c)
Jim Schaad4f646332015-09-02 18:07:47 -070012
Jim Schaad2d883892015-09-01 21:30:49 -070013target_link_libraries (cose_test PRIVATE cose-c )
Jim Schaad4f646332015-09-02 18:07:47 -070014
15## OpenSSL
Jim Schaad4f646332015-09-02 18:07:47 -070016
17target_include_directories(cose_test PRIVATE ${OPENSSL_INCLUDE_DIR})
Jim Schaad4f646332015-09-02 18:07:47 -070018target_link_libraries( cose_test PRIVATE ${OPENSSL_LIBRARIES} )
Jim Schaad265a0872015-09-04 20:40:39 -070019target_link_libraries( cose_test PRIVATE cn-cbor )
Jim Schaad4ac87d12015-12-30 23:23:23 -080020if ( MSVC )
21 target_link_libraries( cose_test PRIVATE ws2_32 )
22endif ()
Jim Schaad4f646332015-09-02 18:07:47 -070023
Jim Schaad2d883892015-09-01 21:30:49 -070024target_include_directories ( cose_test PRIVATE ../include )
25target_include_directories ( cose_test PRIVATE ../src )
26target_include_directories ( cose_test PUBLIC ../../cose/cn-cbor/include )
Jim Schaadf83908c2015-09-02 10:56:01 -070027target_include_directories ( cose_test PUBLIC ../../cn-cbor/implement/cn-cbor/include )
Jim Schaad2d883892015-09-01 21:30:49 -070028
Jim Schaadc4b2d052015-09-03 19:58:43 -070029enable_testing()
Jim Schaad4ac87d12015-12-30 23:23:23 -080030
Jim Schaad265a0872015-09-04 20:40:39 -070031add_test ( NAME cose_test COMMAND cose_test )
Jim Schaad783de542016-01-14 16:42:54 -080032
Jim Schaadd6ebc5c2016-01-04 21:46:11 -080033add_test ( NAME mac-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Mac-02.json )
Jim Schaad723531a2015-12-31 00:47:02 -080034add_test ( NAME mac-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Mac-04.json )
Jim Schaadd8d99d42016-01-08 09:24:06 -080035
Jim Schaadcda1d3d2016-01-07 23:24:34 -080036add_test ( NAME sig-01 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-01.json )
Jim Schaadd8d99d42016-01-08 09:24:06 -080037add_test ( NAME sig-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-02.json )
Jim Schaadcda1d3d2016-01-07 23:24:34 -080038add_test ( NAME sig-03 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-03.json )
39add_test ( NAME sig-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-04.json )
Jim Schaad4ac87d12015-12-30 23:23:23 -080040
Jim Schaad783de542016-01-14 16:42:54 -080041add_test ( NAME enc-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-02.json )
Jim Schaad0b29f552016-01-10 00:41:57 -080042add_test ( NAME enc-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-04.json )
43add_test ( NAME enc-05 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-05.json )
44
Jim Schaad783de542016-01-14 16:42:54 -080045add_test ( NAME aes-ccm WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/aes-ccm-examples )
Jim Schaad6ab073e2016-01-01 11:16:02 -080046
Jim Schaad783de542016-01-14 16:42:54 -080047add_test ( NAME aes-gcm WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/aes-gcm-examples )
Jim Schaad7a7a58c2016-01-02 14:39:56 -080048
Jim Schaad783de542016-01-14 16:42:54 -080049add_test ( NAME cbc-mac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/cbc-mac-examples )
Jim Schaad53a79de2016-01-10 11:32:44 -080050
Jim Schaad4a700962016-01-12 14:48:00 -080051add_test ( NAME ecdsa WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/ecdsa-examples )
Jim Schaad783de542016-01-14 16:42:54 -080052
53add_test ( NAME hmac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hmac-examples )
54
55add_test (NAME hkdf-hmac-sha WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hkdf-hmac-sha-examples )
Jim Schaade54b7d12016-01-14 22:49:35 -080056add_test (NAME hkdf-aes WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hkdf-aes-examples )
Jim Schaadf15f0782016-01-15 10:39:16 -080057
58
59add_test (NAME corner-cases WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --corners )
Jim Schaadde770942016-01-15 12:25:03 -080060add_test (NAME Memory-mac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/hmac-examples/HMac-01.json )
Jim Schaad366d9722016-01-15 20:22:41 -080061add_test (NAME Memory-mac0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/hmac-examples/HMac-enc-01.json )
Jim Schaadb03ed7c2016-01-15 21:08:03 -080062add_test (NAME Memory-encrypt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/aes-gcm-examples/aes-gcm-enc-01.json )
63add_test (NAME Memory-enveloped WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/aes-gcm-examples/aes-gcm-01.json )
Jim Schaad8f94ef42016-01-15 21:30:34 -080064add_test (NAME Memory-sign0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/ecdsa-examples/ecdsa-sig-01.json )
65add_test (NAME Memory-sign WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/ecdsa-examples/ecdsa-01.json )
Jim Schaadde770942016-01-15 12:25:03 -080066