Jim Schaad | 2d88389 | 2015-09-01 21:30:49 -0700 | [diff] [blame] | 1 | # |
| 2 | # Compiling/running tests |
| 3 | # |
| 4 | |
| 5 | if (use_context) |
| 6 | add_definitions(-DUSE_CBOR_CONTEXT) |
| 7 | endif() |
| 8 | |
| 9 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dist_dir}/test ) |
| 10 | |
Jim Schaad | c5a5f6b | 2016-01-09 16:28:26 -0800 | [diff] [blame] | 11 | add_executable ( cose_test test.c json.c encrypt.c sign.c context.c mac_test.c) |
Jim Schaad | 4f64633 | 2015-09-02 18:07:47 -0700 | [diff] [blame] | 12 | |
Jim Schaad | 2d88389 | 2015-09-01 21:30:49 -0700 | [diff] [blame] | 13 | target_link_libraries (cose_test PRIVATE cose-c ) |
Jim Schaad | 4f64633 | 2015-09-02 18:07:47 -0700 | [diff] [blame] | 14 | |
| 15 | ## OpenSSL |
Jim Schaad | 4f64633 | 2015-09-02 18:07:47 -0700 | [diff] [blame] | 16 | |
| 17 | target_include_directories(cose_test PRIVATE ${OPENSSL_INCLUDE_DIR}) |
Jim Schaad | 4f64633 | 2015-09-02 18:07:47 -0700 | [diff] [blame] | 18 | target_link_libraries( cose_test PRIVATE ${OPENSSL_LIBRARIES} ) |
Jim Schaad | 265a087 | 2015-09-04 20:40:39 -0700 | [diff] [blame] | 19 | target_link_libraries( cose_test PRIVATE cn-cbor ) |
Jim Schaad | 4ac87d1 | 2015-12-30 23:23:23 -0800 | [diff] [blame] | 20 | if ( MSVC ) |
| 21 | target_link_libraries( cose_test PRIVATE ws2_32 ) |
| 22 | endif () |
Jim Schaad | 4f64633 | 2015-09-02 18:07:47 -0700 | [diff] [blame] | 23 | |
Jim Schaad | 2d88389 | 2015-09-01 21:30:49 -0700 | [diff] [blame] | 24 | target_include_directories ( cose_test PRIVATE ../include ) |
| 25 | target_include_directories ( cose_test PRIVATE ../src ) |
| 26 | target_include_directories ( cose_test PUBLIC ../../cose/cn-cbor/include ) |
Jim Schaad | f83908c | 2015-09-02 10:56:01 -0700 | [diff] [blame] | 27 | target_include_directories ( cose_test PUBLIC ../../cn-cbor/implement/cn-cbor/include ) |
Jim Schaad | 2d88389 | 2015-09-01 21:30:49 -0700 | [diff] [blame] | 28 | |
Jim Schaad | c4b2d05 | 2015-09-03 19:58:43 -0700 | [diff] [blame] | 29 | enable_testing() |
Jim Schaad | 4ac87d1 | 2015-12-30 23:23:23 -0800 | [diff] [blame] | 30 | |
Jim Schaad | 265a087 | 2015-09-04 20:40:39 -0700 | [diff] [blame] | 31 | add_test ( NAME cose_test COMMAND cose_test ) |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 32 | |
Jim Schaad | d6ebc5c | 2016-01-04 21:46:11 -0800 | [diff] [blame] | 33 | add_test ( NAME mac-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Mac-02.json ) |
Jim Schaad | 723531a | 2015-12-31 00:47:02 -0800 | [diff] [blame] | 34 | add_test ( NAME mac-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Mac-04.json ) |
Jim Schaad | d8d99d4 | 2016-01-08 09:24:06 -0800 | [diff] [blame] | 35 | |
Jim Schaad | cda1d3d | 2016-01-07 23:24:34 -0800 | [diff] [blame] | 36 | add_test ( NAME sig-01 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-01.json ) |
Jim Schaad | d8d99d4 | 2016-01-08 09:24:06 -0800 | [diff] [blame] | 37 | add_test ( NAME sig-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-02.json ) |
Jim Schaad | cda1d3d | 2016-01-07 23:24:34 -0800 | [diff] [blame] | 38 | add_test ( NAME sig-03 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-03.json ) |
| 39 | add_test ( NAME sig-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Sig-04.json ) |
Jim Schaad | 4ac87d1 | 2015-12-30 23:23:23 -0800 | [diff] [blame] | 40 | |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 41 | add_test ( NAME enc-02 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-02.json ) |
Jim Schaad | 0b29f55 | 2016-01-10 00:41:57 -0800 | [diff] [blame] | 42 | add_test ( NAME enc-04 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-04.json ) |
| 43 | add_test ( NAME enc-05 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test Examples/spec-examples/Enc-05.json ) |
| 44 | |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 45 | add_test ( NAME aes-ccm WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/aes-ccm-examples ) |
Jim Schaad | 6ab073e | 2016-01-01 11:16:02 -0800 | [diff] [blame] | 46 | |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 47 | add_test ( NAME aes-gcm WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/aes-gcm-examples ) |
Jim Schaad | 7a7a58c | 2016-01-02 14:39:56 -0800 | [diff] [blame] | 48 | |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 49 | add_test ( NAME cbc-mac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/cbc-mac-examples ) |
Jim Schaad | 53a79de | 2016-01-10 11:32:44 -0800 | [diff] [blame] | 50 | |
Jim Schaad | 4a70096 | 2016-01-12 14:48:00 -0800 | [diff] [blame] | 51 | add_test ( NAME ecdsa WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/ecdsa-examples ) |
Jim Schaad | 783de54 | 2016-01-14 16:42:54 -0800 | [diff] [blame] | 52 | |
| 53 | add_test ( NAME hmac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hmac-examples ) |
| 54 | |
| 55 | add_test (NAME hkdf-hmac-sha WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hkdf-hmac-sha-examples ) |
Jim Schaad | e54b7d1 | 2016-01-14 22:49:35 -0800 | [diff] [blame] | 56 | add_test (NAME hkdf-aes WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --dir Examples/hkdf-aes-examples ) |
Jim Schaad | f15f078 | 2016-01-15 10:39:16 -0800 | [diff] [blame] | 57 | |
| 58 | |
| 59 | add_test (NAME corner-cases WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --corners ) |
Jim Schaad | de77094 | 2016-01-15 12:25:03 -0800 | [diff] [blame] | 60 | add_test (NAME Memory-mac WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/hmac-examples/HMac-01.json ) |
Jim Schaad | 366d972 | 2016-01-15 20:22:41 -0800 | [diff] [blame] | 61 | add_test (NAME Memory-mac0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/hmac-examples/HMac-enc-01.json ) |
Jim Schaad | b03ed7c | 2016-01-15 21:08:03 -0800 | [diff] [blame] | 62 | add_test (NAME Memory-encrypt WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/aes-gcm-examples/aes-gcm-enc-01.json ) |
| 63 | add_test (NAME Memory-enveloped WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/aes-gcm-examples/aes-gcm-01.json ) |
Jim Schaad | 8f94ef4 | 2016-01-15 21:30:34 -0800 | [diff] [blame] | 64 | add_test (NAME Memory-sign0 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/ecdsa-examples/ecdsa-sig-01.json ) |
| 65 | add_test (NAME Memory-sign WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND cose_test --memory Examples/ecdsa-examples/ecdsa-01.json ) |
Jim Schaad | de77094 | 2016-01-15 12:25:03 -0800 | [diff] [blame] | 66 | |