diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-12-19 13:41:27 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-12-19 13:41:27 -0900 |
| commit | 7f06929aeb539cd9ba89a7fa2153d7423f1a9fa4 (patch) | |
| tree | 9f39edbb4ac5b7172d24dd9586ef571b51c472aa /tests | |
| parent | aa42d103b935dfb85ef5f63300eb601e2cf434c3 (diff) | |
| download | otputils-7f06929aeb539cd9ba89a7fa2153d7423f1a9fa4.tar.gz otputils-7f06929aeb539cd9ba89a7fa2153d7423f1a9fa4.tar.bz2 otputils-7f06929aeb539cd9ba89a7fa2153d7423f1a9fa4.tar.xz otputils-7f06929aeb539cd9ba89a7fa2153d7423f1a9fa4.zip | |
tests: removing encoding/decoding tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/base32-decoding.c | 69 | ||||
| -rw-r--r-- | tests/base32-encoding.c | 69 | ||||
| -rw-r--r-- | tests/base32-validate.c | 69 | ||||
| -rw-r--r-- | tests/base32hex-decoding.c | 69 | ||||
| -rw-r--r-- | tests/base32hex-encoding.c | 69 | ||||
| -rw-r--r-- | tests/base32hex-validate.c | 69 | ||||
| -rw-r--r-- | tests/base64-decoding.c | 70 | ||||
| -rw-r--r-- | tests/base64-encoding.c | 70 | ||||
| -rw-r--r-- | tests/base64-validate.c | 69 | ||||
| -rw-r--r-- | tests/crockford-decoding.c | 69 | ||||
| -rw-r--r-- | tests/crockford-encoding.c | 69 | ||||
| -rw-r--r-- | tests/crockford-validate.c | 69 | ||||
| -rw-r--r-- | tests/hex-decoding.c | 70 | ||||
| -rw-r--r-- | tests/hex-encoding.c | 70 | ||||
| -rw-r--r-- | tests/hex-validate.c | 69 | ||||
| -rw-r--r-- | tests/test-strings.c | 359 | ||||
| -rw-r--r-- | tests/test-strings.h | 101 |
17 files changed, 0 insertions, 1499 deletions
diff --git a/tests/base32-decoding.c b/tests/base32-decoding.c deleted file mode 100644 index 7c7325d..0000000 --- a/tests/base32-decoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_decode(TOTPUTILS_BASE32, base32_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base32-encoding.c b/tests/base32-encoding.c deleted file mode 100644 index d2b58f3..0000000 --- a/tests/base32-encoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_encode(TOTPUTILS_BASE32, base32_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base32-validate.c b/tests/base32-validate.c deleted file mode 100644 index 690ec4f..0000000 --- a/tests/base32-validate.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-validate.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32_VALIDATE_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_validate(TOTPUTILS_BASE32, base32_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base32hex-decoding.c b/tests/base32hex-decoding.c deleted file mode 100644 index 33bbd5c..0000000 --- a/tests/base32hex-decoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32hex-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32HEX_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_decode(TOTPUTILS_BASE32HEX, base32hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base32hex-encoding.c b/tests/base32hex-encoding.c deleted file mode 100644 index cbe4bfd..0000000 --- a/tests/base32hex-encoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_encode(TOTPUTILS_BASE32HEX, base32hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base32hex-validate.c b/tests/base32hex-validate.c deleted file mode 100644 index c8f7036..0000000 --- a/tests/base32hex-validate.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32hex-validate.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE32HEX_VALIDATE_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_validate(TOTPUTILS_BASE32HEX, base32hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/base64-decoding.c b/tests/base64-decoding.c deleted file mode 100644 index a5e525e..0000000 --- a/tests/base64-decoding.c +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base64-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE64_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_decode(TOTPUTILS_BASE64, base64_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* end of source file */ | ||
diff --git a/tests/base64-encoding.c b/tests/base64-encoding.c deleted file mode 100644 index 3b63d94..0000000 --- a/tests/base64-encoding.c +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base64-encoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE64_ENCODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_encode(TOTPUTILS_BASE64, base64_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* end of source file */ | ||
diff --git a/tests/base64-validate.c b/tests/base64-validate.c deleted file mode 100644 index ce1b055..0000000 --- a/tests/base64-validate.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base64-validate.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_BASE64_VALIDATE_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_validate(TOTPUTILS_BASE64, base64_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/crockford-decoding.c b/tests/crockford-decoding.c deleted file mode 100644 index f30f65e..0000000 --- a/tests/crockford-decoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/crockford-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_CROCKFORD_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_decode(TOTPUTILS_CROCKFORD, crockford_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/crockford-encoding.c b/tests/crockford-encoding.c deleted file mode 100644 index 2c7d7f5..0000000 --- a/tests/crockford-encoding.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/crockford-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_CROCKFORD_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_encode(TOTPUTILS_CROCKFORD, crockford_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/crockford-validate.c b/tests/crockford-validate.c deleted file mode 100644 index 5e28c15..0000000 --- a/tests/crockford-validate.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/crockford-validate.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_CROCKFORD_VALIDATE_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_validate(TOTPUTILS_CROCKFORD, crockford_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/hex-decoding.c b/tests/hex-decoding.c deleted file mode 100644 index 1d3615d..0000000 --- a/tests/hex-decoding.c +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/hex-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_HEX_DECODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_decode(TOTPUTILS_HEX, hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* end of source file */ | ||
diff --git a/tests/hex-encoding.c b/tests/hex-encoding.c deleted file mode 100644 index 693b700..0000000 --- a/tests/hex-encoding.c +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/hex-encoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_HEX_ENCODING_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_encode(TOTPUTILS_HEX, hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 | /* end of source file */ | ||
diff --git a/tests/hex-validate.c b/tests/hex-validate.c deleted file mode 100644 index 54b52d2..0000000 --- a/tests/hex-validate.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/hex-validate.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_HEX_VALIDATE_C 1 | ||
| 34 | |||
| 35 | /////////////// | ||
| 36 | // // | ||
| 37 | // Headers // | ||
| 38 | // // | ||
| 39 | /////////////// | ||
| 40 | #pragma mark - Headers | ||
| 41 | |||
| 42 | #include <totputils.h> | ||
| 43 | |||
| 44 | #include "test-strings.h" | ||
| 45 | |||
| 46 | |||
| 47 | ////////////////// | ||
| 48 | // // | ||
| 49 | // Prototypes // | ||
| 50 | // // | ||
| 51 | ////////////////// | ||
| 52 | #pragma mark - Prototypes | ||
| 53 | |||
| 54 | int main(void); | ||
| 55 | |||
| 56 | |||
| 57 | ///////////////// | ||
| 58 | // // | ||
| 59 | // Functions // | ||
| 60 | // // | ||
| 61 | ///////////////// | ||
| 62 | #pragma mark - Functions | ||
| 63 | |||
| 64 | int main(void) | ||
| 65 | { | ||
| 66 | return(totputils_test_validate(TOTPUTILS_HEX, hex_strings)); | ||
| 67 | } | ||
| 68 | |||
| 69 | /* end of source file */ | ||
diff --git a/tests/test-strings.c b/tests/test-strings.c deleted file mode 100644 index 3d45078..0000000 --- a/tests/test-strings.c +++ /dev/null | |||
| @@ -1,359 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-decoding.c | ||
| 32 | */ | ||
| 33 | #define _TESTS_TEST_STRINGS_C 1 | ||
| 34 | #include "test-strings.h" | ||
| 35 | |||
| 36 | /////////////// | ||
| 37 | // // | ||
| 38 | // Headers // | ||
| 39 | // // | ||
| 40 | /////////////// | ||
| 41 | #pragma mark - Headers | ||
| 42 | |||
| 43 | #include <string.h> | ||
| 44 | #include <strings.h> | ||
| 45 | #include <stdlib.h> | ||
| 46 | |||
| 47 | #include <totputils.h> | ||
| 48 | |||
| 49 | |||
| 50 | ///////////////// | ||
| 51 | // // | ||
| 52 | // Variables // | ||
| 53 | // // | ||
| 54 | ///////////////// | ||
| 55 | #pragma mark - Variables | ||
| 56 | |||
| 57 | #pragma mark base32_strings[] | ||
| 58 | struct test_data base32_strings[] = | ||
| 59 | { | ||
| 60 | { .dec = "", .enc = "", .nopad = 0 }, | ||
| 61 | { .dec = NULL, .enc = "M=======", .nopad = 0 }, | ||
| 62 | { .dec = NULL, .enc = "MY=====", .nopad = 0 }, | ||
| 63 | { .dec = "f", .enc = "MY======", .nopad = 0 }, | ||
| 64 | { .dec = NULL, .enc = "MZX=====", .nopad = 0 }, | ||
| 65 | { .dec = "fo", .enc = "MZXQ====", .nopad = 0 }, | ||
| 66 | { .dec = "foo", .enc = "MZXW6===", .nopad = 0 }, | ||
| 67 | { .dec = "foob", .enc = "MZXW6YQ=", .nopad = 0 }, | ||
| 68 | { .dec = "fooba", .enc = "MZXW6YTB", .nopad = 0 }, | ||
| 69 | { .dec = "foobar", .enc = "MZXW6YTBOI======", .nopad = 0 }, | ||
| 70 | { .dec = "foobarb", .enc = "MZXW6YTBOJRA====", .nopad = 0 }, | ||
| 71 | { .dec = "foobarba", .enc = "MZXW6YTBOJRGC===", .nopad = 0 }, | ||
| 72 | { .dec = "foobarbar", .enc = "MZXW6YTBOJRGC4Q=", .nopad = 0 }, | ||
| 73 | { .dec = "foobarbarf", .enc = "MZXW6YTBOJRGC4TG", .nopad = 0 }, | ||
| 74 | { .dec = "foobarbarfo", .enc = "MZXW6YTBOJRGC4TGN4======", .nopad = 0 }, | ||
| 75 | { .dec = "foobarbarfoo", .enc = "MZXW6YTBOJRGC4TGN5XQ====", .nopad = 0 }, | ||
| 76 | { .dec = "", .enc = "", .nopad = 1 }, | ||
| 77 | { .dec = "f", .enc = "MY", .nopad = 1 }, | ||
| 78 | { .dec = "fo", .enc = "MZXQ", .nopad = 1 }, | ||
| 79 | { .dec = "foo", .enc = "MZXW6", .nopad = 1 }, | ||
| 80 | { .dec = "foob", .enc = "MZXW6YQ", .nopad = 1 }, | ||
| 81 | { .dec = "fooba", .enc = "MZXW6YTB", .nopad = 1 }, | ||
| 82 | { .dec = "foobar", .enc = "MZXW6YTBOI", .nopad = 1 }, | ||
| 83 | { .dec = "foobarb", .enc = "MZXW6YTBOJRA", .nopad = 1 }, | ||
| 84 | { .dec = "foobarba", .enc = "MZXW6YTBOJRGC", .nopad = 1 }, | ||
| 85 | { .dec = "foobarbar", .enc = "MZXW6YTBOJRGC4Q", .nopad = 1 }, | ||
| 86 | { .dec = "foobarbarf", .enc = "MZXW6YTBOJRGC4TG", .nopad = 1 }, | ||
| 87 | { .dec = "foobarbarfo", .enc = "MZXW6YTBOJRGC4TGN4", .nopad = 1 }, | ||
| 88 | { .dec = "foobarbarfoo", .enc = "MZXW6YTBOJRGC4TGN5XQ", .nopad = 1 }, | ||
| 89 | { .dec = NULL, .enc = NULL, .nopad = 0 } | ||
| 90 | }; | ||
| 91 | |||
| 92 | |||
| 93 | #pragma mark base32hex_strings[] | ||
| 94 | struct test_data base32hex_strings[] = | ||
| 95 | { | ||
| 96 | { .dec = "", .enc = "", .nopad = 0 }, | ||
| 97 | { .dec = "f", .enc = "CO======", .nopad = 0 }, | ||
| 98 | { .dec = "fo", .enc = "CPNG====", .nopad = 0 }, | ||
| 99 | { .dec = "foo", .enc = "CPNMU===", .nopad = 0 }, | ||
| 100 | { .dec = "foob", .enc = "CPNMUOG=", .nopad = 0 }, | ||
| 101 | { .dec = "fooba", .enc = "CPNMUOJ1", .nopad = 0 }, | ||
| 102 | { .dec = "foobar", .enc = "CPNMUOJ1E8======", .nopad = 0 }, | ||
| 103 | { .dec = "foobarb", .enc = "CPNMUOJ1E9H0====", .nopad = 0 }, | ||
| 104 | { .dec = "foobarba", .enc = "CPNMUOJ1E9H62===", .nopad = 0 }, | ||
| 105 | { .dec = "foobarbar", .enc = "CPNMUOJ1E9H62SG=", .nopad = 0 }, | ||
| 106 | { .dec = "foobarbarf", .enc = "CPNMUOJ1E9H62SJ6", .nopad = 0 }, | ||
| 107 | { .dec = "foobarbarfo", .enc = "CPNMUOJ1E9H62SJ6DS======", .nopad = 0 }, | ||
| 108 | { .dec = "foobarbarfoo", .enc = "CPNMUOJ1E9H62SJ6DTNG====", .nopad = 0 }, | ||
| 109 | { .dec = "", .enc = "", .nopad = 1 }, | ||
| 110 | { .dec = "f", .enc = "CO", .nopad = 1 }, | ||
| 111 | { .dec = "fo", .enc = "CPNG", .nopad = 1 }, | ||
| 112 | { .dec = "foo", .enc = "CPNMU", .nopad = 1 }, | ||
| 113 | { .dec = "foob", .enc = "CPNMUOG", .nopad = 1 }, | ||
| 114 | { .dec = "fooba", .enc = "CPNMUOJ1", .nopad = 1 }, | ||
| 115 | { .dec = "foobar", .enc = "CPNMUOJ1E8", .nopad = 1 }, | ||
| 116 | { .dec = "foobarb", .enc = "CPNMUOJ1E9H0", .nopad = 1 }, | ||
| 117 | { .dec = "foobarba", .enc = "CPNMUOJ1E9H62", .nopad = 1 }, | ||
| 118 | { .dec = "foobarbar", .enc = "CPNMUOJ1E9H62SG", .nopad = 1 }, | ||
| 119 | { .dec = "foobarbarf", .enc = "CPNMUOJ1E9H62SJ6", .nopad = 1 }, | ||
| 120 | { .dec = "foobarbarfo", .enc = "CPNMUOJ1E9H62SJ6DS", .nopad = 1 }, | ||
| 121 | { .dec = "foobarbarfoo", .enc = "CPNMUOJ1E9H62SJ6DTNG", .nopad = 1 }, | ||
| 122 | { .dec = NULL, .enc = NULL, .nopad = 0 } | ||
| 123 | }; | ||
| 124 | |||
| 125 | |||
| 126 | #pragma mark base64_strings[] | ||
| 127 | struct test_data base64_strings[] = | ||
| 128 | { | ||
| 129 | { .dec = "", .enc = "", .nopad = 0 }, | ||
| 130 | { .dec = "f", .enc = "Zg==", .nopad = 0 }, | ||
| 131 | { .dec = "fo", .enc = "Zm8=", .nopad = 0 }, | ||
| 132 | { .dec = "foo", .enc = "Zm9v", .nopad = 0 }, | ||
| 133 | { .dec = "foob", .enc = "Zm9vYg==", .nopad = 0 }, | ||
| 134 | { .dec = "fooba", .enc = "Zm9vYmE=", .nopad = 0 }, | ||
| 135 | { .dec = "foobar", .enc = "Zm9vYmFy", .nopad = 0 }, | ||
| 136 | { .dec = "foobarb", .enc = "Zm9vYmFyYg==", .nopad = 0 }, | ||
| 137 | { .dec = "foobarba", .enc = "Zm9vYmFyYmE=", .nopad = 0 }, | ||
| 138 | { .dec = "foobarbar", .enc = "Zm9vYmFyYmFy", .nopad = 0 }, | ||
| 139 | { .dec = "foobarbarf", .enc = "Zm9vYmFyYmFyZg==", .nopad = 0 }, | ||
| 140 | { .dec = "foobarbarfo", .enc = "Zm9vYmFyYmFyZm8=", .nopad = 0 }, | ||
| 141 | { .dec = "foobarbarfoo", .enc = "Zm9vYmFyYmFyZm9v", .nopad = 0 }, | ||
| 142 | { .dec = "", .enc = "", .nopad = 1 }, | ||
| 143 | { .dec = "f", .enc = "Zg", .nopad = 1 }, | ||
| 144 | { .dec = "fo", .enc = "Zm8", .nopad = 1 }, | ||
| 145 | { .dec = "foo", .enc = "Zm9v", .nopad = 1 }, | ||
| 146 | { .dec = "foob", .enc = "Zm9vYg", .nopad = 1 }, | ||
| 147 | { .dec = "fooba", .enc = "Zm9vYmE", .nopad = 1 }, | ||
| 148 | { .dec = "foobar", .enc = "Zm9vYmFy", .nopad = 1 }, | ||
| 149 | { .dec = "foobarb", .enc = "Zm9vYmFyYg", .nopad = 1 }, | ||
| 150 | { .dec = "foobarba", .enc = "Zm9vYmFyYmE", .nopad = 1 }, | ||
| 151 | { .dec = "foobarbar", .enc = "Zm9vYmFyYmFy", .nopad = 1 }, | ||
| 152 | { .dec = "foobarbarf", .enc = "Zm9vYmFyYmFyZg", .nopad = 1 }, | ||
| 153 | { .dec = "foobarbarfo", .enc = "Zm9vYmFyYmFyZm8", .nopad = 1 }, | ||
| 154 | { .dec = "foobarbarfoo", .enc = "Zm9vYmFyYmFyZm9v", .nopad = 1 }, | ||
| 155 | { .dec = "5nuvF7DY4/PY+APIzP", .enc = "NW51dkY3RFk0L1BZK0FQSXpQ", .nopad = 1 }, | ||
| 156 | { .dec = "wpq83IwsEv3ci0hf2S", .enc = "d3BxODNJd3NFdjNjaTBoZjJT", .nopad = 1 }, | ||
| 157 | { .dec = "4ltI0yv+ddKjyEN6IU", .enc = "NGx0STB5ditkZEtqeUVONklV", .nopad = 1 }, | ||
| 158 | { .dec = "sLo8FOEOQGzDtXIE72", .enc = "c0xvOEZPRU9RR3pEdFhJRTcy", .nopad = 1 }, | ||
| 159 | { .dec = "uQBsjzE1uZ287j0hIW", .enc = "dVFCc2p6RTF1WjI4N2owaElX", .nopad = 1 }, | ||
| 160 | { .dec = "5OcM4X4uibUIsf0KF/", .enc = "NU9jTTRYNHVpYlVJc2YwS0Yv", .nopad = 1 }, | ||
| 161 | { .dec = "2WGVwxQBvpMz6d/a+O", .enc = "MldHVnd4UUJ2cE16NmQvYStP", .nopad = 1 }, | ||
| 162 | { .dec = "u1OAtBFMPKCWnS7fw8", .enc = "dTFPQXRCRk1QS0NXblM3Znc4", .nopad = 1 }, | ||
| 163 | { .dec = "XsbP5uIZ1RMOLH8Tzo", .enc = "WHNiUDV1SVoxUk1PTEg4VHpv", .nopad = 1 }, | ||
| 164 | { .dec = "L8C0IUt45j42ic36+k", .enc = "TDhDMElVdDQ1ajQyaWMzNitr", .nopad = 1 }, | ||
| 165 | { .dec = "HqC2LnE2qxADXk3g7+", .enc = "SHFDMkxuRTJxeEFEWGszZzcr", .nopad = 1 }, | ||
| 166 | { .dec = "ko4QuyAGFQD2IUPZU8", .enc = "a280UXV5QUdGUUQySVVQWlU4", .nopad = 1 }, | ||
| 167 | { .dec = NULL, .enc = NULL, .nopad = 0 } | ||
| 168 | }; | ||
| 169 | |||
| 170 | |||
| 171 | #pragma mark crockford_strings[] | ||
| 172 | struct test_data crockford_strings[] = | ||
| 173 | { | ||
| 174 | { .dec = "", .enc = "", .nopad = 0 }, | ||
| 175 | { .dec = "f", .enc = "CR", .nopad = 0 }, | ||
| 176 | { .dec = "fo", .enc = "CSQG", .nopad = 0 }, | ||
| 177 | { .dec = "foo", .enc = "CSQPY", .nopad = 0 }, | ||
| 178 | { .dec = "foob", .enc = "CSQPYRG", .nopad = 0 }, | ||
| 179 | { .dec = "fooba", .enc = "CSQPYRK1", .nopad = 0 }, | ||
| 180 | { .dec = "foobar", .enc = "CSQPYRK1E8", .nopad = 0 }, | ||
| 181 | { .dec = "foobarb", .enc = "CSQPYRK1E9H0", .nopad = 0 }, | ||
| 182 | { .dec = "foobarba", .enc = "CSQPYRK1E9H62", .nopad = 0 }, | ||
| 183 | { .dec = "foobarbar", .enc = "CSQPYRK1E9H62WG", .nopad = 0 }, | ||
| 184 | { .dec = "foobarbarf", .enc = "CSQPYRK1E9H62WK6", .nopad = 0 }, | ||
| 185 | { .dec = "foobarbarfo", .enc = "CSQPYRK1E9H62WK6DW", .nopad = 0 }, | ||
| 186 | { .dec = "foobarbarfoo", .enc = "CSQPYRK1E9H62WK6DXQG", .nopad = 0 }, | ||
| 187 | { .dec = NULL, .enc = NULL, .nopad = 0 } | ||
| 188 | }; | ||
| 189 | |||
| 190 | |||
| 191 | #pragma mark hex_strings[] | ||
| 192 | struct test_data hex_strings[] = | ||
| 193 | { | ||
| 194 | { .dec = "", .enc = "", .nopad = 0 }, | ||
| 195 | { .dec = "f", .enc = "66", .nopad = 0 }, | ||
| 196 | { .dec = "fo", .enc = "666f", .nopad = 0 }, | ||
| 197 | { .dec = "foo", .enc = "666f6f", .nopad = 0 }, | ||
| 198 | { .dec = "foob", .enc = "666f6f62", .nopad = 0 }, | ||
| 199 | { .dec = "fooba", .enc = "666f6f6261", .nopad = 0 }, | ||
| 200 | { .dec = "foobar", .enc = "666f6f626172", .nopad = 0 }, | ||
| 201 | { .dec = "foobarb", .enc = "666f6f62617262", .nopad = 0 }, | ||
| 202 | { .dec = "foobarba", .enc = "666f6f6261726261", .nopad = 0 }, | ||
| 203 | { .dec = "foobarbar", .enc = "666f6f626172626172", .nopad = 0 }, | ||
| 204 | { .dec = "foobarbarf", .enc = "666f6f62617262617266", .nopad = 0 }, | ||
| 205 | { .dec = "foobarbarfo", .enc = "666f6f626172626172666f", .nopad = 0 }, | ||
| 206 | { .dec = "foobarbarfoo", .enc = "666f6f626172626172666f6f", .nopad = 0 }, | ||
| 207 | { .dec = NULL, .enc = NULL, .nopad = 0 } | ||
| 208 | }; | ||
| 209 | |||
| 210 | |||
| 211 | ///////////////// | ||
| 212 | // // | ||
| 213 | // Functions // | ||
| 214 | // // | ||
| 215 | ///////////////// | ||
| 216 | #pragma mark - Functions | ||
| 217 | |||
| 218 | int | ||
| 219 | totputils_test_decode( | ||
| 220 | int method, | ||
| 221 | struct test_data * data ) | ||
| 222 | { | ||
| 223 | size_t pos; | ||
| 224 | char buff[24]; | ||
| 225 | int err; | ||
| 226 | ssize_t len; | ||
| 227 | const char * dec; | ||
| 228 | const char * enc; | ||
| 229 | int exit_code; | ||
| 230 | char msg[128]; | ||
| 231 | |||
| 232 | exit_code = 0; | ||
| 233 | |||
| 234 | for(pos = 0; (((data[pos].dec)) || ((data[pos].enc))); pos++) | ||
| 235 | { | ||
| 236 | dec = data[pos].dec; | ||
| 237 | enc = data[pos].enc; | ||
| 238 | |||
| 239 | if ( (!(dec)) || (!(enc)) ) | ||
| 240 | continue; | ||
| 241 | |||
| 242 | snprintf(msg, sizeof(msg), "decoding \"%s\" ... ", enc); | ||
| 243 | printf("%-40s", msg); | ||
| 244 | |||
| 245 | len = totputils_decode(method, buff, sizeof(buff), enc, strlen(enc), &err); | ||
| 246 | if (len == -1) | ||
| 247 | { | ||
| 248 | printf("FAIL -- %s\n", totputils_err2string(err)); | ||
| 249 | exit_code = 1; | ||
| 250 | } else { | ||
| 251 | buff[len] = '\0'; | ||
| 252 | if (!(strcmp(dec, buff))) | ||
| 253 | { | ||
| 254 | printf("PASS\n"); | ||
| 255 | } else { | ||
| 256 | printf("FAIL \"%s\"\n", buff); | ||
| 257 | exit_code = 1; | ||
| 258 | }; | ||
| 259 | }; | ||
| 260 | }; | ||
| 261 | |||
| 262 | return(exit_code); | ||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | int | ||
| 267 | totputils_test_encode( | ||
| 268 | int method, | ||
| 269 | struct test_data * data ) | ||
| 270 | { | ||
| 271 | size_t pos; | ||
| 272 | char buff[24]; | ||
| 273 | int err; | ||
| 274 | ssize_t len; | ||
| 275 | const char * dec; | ||
| 276 | const char * enc; | ||
| 277 | int exit_code; | ||
| 278 | int nopad; | ||
| 279 | char msg[128]; | ||
| 280 | |||
| 281 | exit_code = 0; | ||
| 282 | |||
| 283 | for(pos = 0; (((data[pos].dec)) || ((data[pos].enc))); pos++) | ||
| 284 | { | ||
| 285 | dec = data[pos].dec; | ||
| 286 | enc = data[pos].enc; | ||
| 287 | nopad = (int)data[pos].nopad; | ||
| 288 | |||
| 289 | if ( (!(dec)) || (!(enc)) ) | ||
| 290 | continue; | ||
| 291 | |||
| 292 | snprintf(msg, sizeof(msg), "encoding \"%s\" ... ", dec); | ||
| 293 | printf("%-35s", msg); | ||
| 294 | |||
| 295 | len = totputils_encode(method, buff, sizeof(buff), dec, strlen(dec), nopad, &err); | ||
| 296 | if (len == -1) | ||
| 297 | { | ||
| 298 | printf("FAIL -- %s\n", totputils_err2string(err)); | ||
| 299 | exit_code = 1; | ||
| 300 | } else { | ||
| 301 | buff[len] = '\0'; | ||
| 302 | if (!(strcmp(enc, buff))) | ||
| 303 | { | ||
| 304 | printf("PASS\n"); | ||
| 305 | } else { | ||
| 306 | printf("FAIL expected: \"%s\"; received: \"%s\"\n", enc, buff); | ||
| 307 | exit_code = 1; | ||
| 308 | }; | ||
| 309 | }; | ||
| 310 | }; | ||
| 311 | |||
| 312 | return(exit_code); | ||
| 313 | } | ||
| 314 | |||
| 315 | |||
| 316 | int | ||
| 317 | totputils_test_validate( | ||
| 318 | int method, | ||
| 319 | struct test_data * data ) | ||
| 320 | { | ||
| 321 | size_t pos; | ||
| 322 | ssize_t rc; | ||
| 323 | ssize_t len; | ||
| 324 | const char * dec; | ||
| 325 | const char * enc; | ||
| 326 | int exit_code; | ||
| 327 | char msg[128]; | ||
| 328 | |||
| 329 | exit_code = 0; | ||
| 330 | |||
| 331 | for(pos = 0; ((data[pos].enc)); pos++) | ||
| 332 | { | ||
| 333 | dec = data[pos].dec; | ||
| 334 | enc = data[pos].enc; | ||
| 335 | |||
| 336 | snprintf(msg, sizeof(msg), "validating \"%s\" ... ", enc); | ||
| 337 | printf("%-45s", msg); | ||
| 338 | |||
| 339 | rc = totputils_encoding_verify(method, enc, strlen(enc)); | ||
| 340 | len = ((dec)) ? ((ssize_t)strlen(dec)) : -1; | ||
| 341 | |||
| 342 | if ( (!(dec)) && (len >= 0) ) | ||
| 343 | { | ||
| 344 | printf("FAIL -- validate passed bad string\n"); | ||
| 345 | exit_code = 1; | ||
| 346 | } else if (len != rc) | ||
| 347 | { | ||
| 348 | printf("FAIL -- validate reported incorrect length\n"); | ||
| 349 | exit_code = 1; | ||
| 350 | } else | ||
| 351 | { | ||
| 352 | printf(((dec)) ? "PASS\n" : "PASS (caught bad encoding)\n"); | ||
| 353 | }; | ||
| 354 | }; | ||
| 355 | |||
| 356 | return(exit_code); | ||
| 357 | } | ||
| 358 | |||
| 359 | /* end of source file */ | ||
diff --git a/tests/test-strings.h b/tests/test-strings.h deleted file mode 100644 index 2f4b175..0000000 --- a/tests/test-strings.h +++ /dev/null | |||
| @@ -1,101 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * TOTP Utilities | ||
| 3 | * Copyright (C) 2020 David M. Syzdek <david@syzdek.net>. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions are | ||
| 7 | * met: | ||
| 8 | * | ||
| 9 | * * Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * * Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * * Neither the name of David M. Syzdek nor the | ||
| 15 | * names of its contributors may be used to endorse or promote products | ||
| 16 | * derived from this software without specific prior written permission. | ||
| 17 | * | ||
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
| 19 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
| 20 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID M SYZDEK BE LIABLE FOR | ||
| 22 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 28 | * SUCH DAMAGE. | ||
| 29 | */ | ||
| 30 | /* | ||
| 31 | * @file tests/base32-decoding.c | ||
| 32 | */ | ||
| 33 | #ifndef _TESTS_TEST_STRINGS_H | ||
| 34 | #define _TESTS_TEST_STRINGS_H 1 | ||
| 35 | |||
| 36 | /////////////// | ||
| 37 | // // | ||
| 38 | // Headers // | ||
| 39 | // // | ||
| 40 | /////////////// | ||
| 41 | #pragma mark - Headers | ||
| 42 | |||
| 43 | #include <string.h> | ||
| 44 | #include <strings.h> | ||
| 45 | #include <stdlib.h> | ||
| 46 | |||
| 47 | |||
| 48 | ///////////////// | ||
| 49 | // // | ||
| 50 | // Datatypes // | ||
| 51 | // // | ||
| 52 | ///////////////// | ||
| 53 | #pragma mark - Datatypes | ||
| 54 | |||
| 55 | struct test_data | ||
| 56 | { | ||
| 57 | const char * dec; | ||
| 58 | const char * enc; | ||
| 59 | intptr_t nopad; | ||
| 60 | }; | ||
| 61 | |||
| 62 | |||
| 63 | ///////////////// | ||
| 64 | // // | ||
| 65 | // Variables // | ||
| 66 | // // | ||
| 67 | ///////////////// | ||
| 68 | #pragma mark - Variables | ||
| 69 | |||
| 70 | extern struct test_data base32_strings[]; | ||
| 71 | extern struct test_data base32hex_strings[]; | ||
| 72 | extern struct test_data base64_strings[]; | ||
| 73 | extern struct test_data crockford_strings[]; | ||
| 74 | extern struct test_data hex_strings[]; | ||
| 75 | |||
| 76 | |||
| 77 | ////////////////// | ||
| 78 | // // | ||
| 79 | // Prototypes // | ||
| 80 | // // | ||
| 81 | ////////////////// | ||
| 82 | #pragma mark - Prototypes | ||
| 83 | |||
| 84 | int | ||
| 85 | totputils_test_decode( | ||
| 86 | int method, | ||
| 87 | struct test_data * data ); | ||
| 88 | |||
| 89 | |||
| 90 | int | ||
| 91 | totputils_test_encode( | ||
| 92 | int method, | ||
| 93 | struct test_data * data ); | ||
| 94 | |||
| 95 | |||
| 96 | int | ||
| 97 | totputils_test_validate( | ||
| 98 | int method, | ||
| 99 | struct test_data * data ); | ||
| 100 | |||
| 101 | #endif /* end of header file */ | ||
