Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 13-Nov-2024 | - | ||||
.gitignore | H A D | 22-Sep-2024 | 127 | 7 | 5 | |
CMakeLists.txt | H A D | 22-Oct-2024 | 2.3 KiB | 60 | 55 | |
Makefile.am | H A D | 14-Nov-2024 | 2.6 KiB | 79 | 34 | |
Makefile.inc | H A D | 22-Sep-2024 | 3.9 KiB | 148 | 67 | |
README.md | H A D | 04-Aug-2024 | 2.3 KiB | 74 | 46 | |
curlcheck.h | H A D | 12-May-2024 | 5.4 KiB | 112 | 73 | |
unit1300.c | H A D | 21-Aug-2024 | 9.5 KiB | 276 | 120 | |
unit1302.c | H A D | 22-Sep-2024 | 6.7 KiB | 192 | 134 | |
unit1303.c | H A D | 22-Sep-2024 | 5.5 KiB | 155 | 87 | |
unit1304.c | H A D | 17-Nov-2024 | 6.1 KiB | 196 | 122 | |
unit1305.c | H A D | 22-Sep-2024 | 3.3 KiB | 132 | 82 | |
unit1307.c | H A D | 31-Oct-2024 | 14.6 KiB | 322 | 254 | |
unit1308.c | H A D | 21-Sep-2024 | 3.3 KiB | 110 | 65 | |
unit1309.c | H A D | 19-Sep-2024 | 3.6 KiB | 145 | 91 | |
unit1323.c | H A D | 07-Aug-2023 | 2 KiB | 69 | 38 | |
unit1330.c | H A D | 03-Jan-2023 | 1.2 KiB | 44 | 13 | |
unit1394.c | H A D | 22-Nov-2023 | 4.6 KiB | 134 | 100 | |
unit1395.c | H A D | 21-Nov-2023 | 3 KiB | 108 | 71 | |
unit1396.c | H A D | 03-Jan-2023 | 3.2 KiB | 118 | 78 | |
unit1397.c | H A D | 07-Aug-2023 | 4 KiB | 125 | 91 | |
unit1398.c | H A D | 31-Oct-2024 | 7.9 KiB | 192 | 128 | |
unit1399.c | H A D | 19-Sep-2024 | 4.1 KiB | 120 | 68 | |
unit1600.c | H A D | 03-Jan-2023 | 2.5 KiB | 76 | 38 | |
unit1601.c | H A D | 07-Sep-2023 | 1.8 KiB | 61 | 24 | |
unit1602.c | H A D | 22-Aug-2024 | 2.1 KiB | 81 | 43 | |
unit1603.c | H A D | 22-Aug-2024 | 6.9 KiB | 179 | 111 | |
unit1604.c | H A D | 26-Sep-2024 | 7.1 KiB | 269 | 222 | |
unit1605.c | H A D | 03-Jan-2023 | 1.7 KiB | 60 | 27 | |
unit1606.c | H A D | 22-Sep-2024 | 2.6 KiB | 94 | 57 | |
unit1607.c | H A D | 13-Apr-2024 | 6.5 KiB | 236 | 169 | |
unit1608.c | H A D | 17-Aug-2023 | 2.2 KiB | 90 | 48 | |
unit1609.c | H A D | 15-Aug-2024 | 6.2 KiB | 220 | 125 | |
unit1610.c | H A D | 13-Aug-2024 | 2.1 KiB | 67 | 31 | |
unit1611.c | H A D | 13-May-2023 | 1.8 KiB | 61 | 25 | |
unit1612.c | H A D | 15-Oct-2024 | 2.1 KiB | 71 | 34 | |
unit1614.c | H A D | 16-Sep-2024 | 5.9 KiB | 167 | 136 | |
unit1615.c | H A D | 13-Aug-2024 | 7.6 KiB | 160 | 114 | |
unit1616.c | H A D | 22-Aug-2024 | 2.5 KiB | 87 | 49 | |
unit1620.c | H A D | 25-May-2024 | 4.3 KiB | 132 | 87 | |
unit1621.c | H A D | 01-Apr-2023 | 2.3 KiB | 82 | 47 | |
unit1650.c | H A D | 06-Sep-2024 | 9.5 KiB | 298 | 230 | |
unit1651.c | H A D | 19-Dec-2023 | 26 KiB | 393 | 351 | |
unit1652.c | H A D | 31-Oct-2024 | 4.8 KiB | 154 | 90 | |
unit1653.c | H A D | 18-May-2023 | 6.6 KiB | 233 | 175 | |
unit1654.c | H A D | 12-Aug-2024 | 3.9 KiB | 114 | 74 | |
unit1655.c | H A D | 06-Sep-2024 | 6.8 KiB | 191 | 125 | |
unit1656.c | H A D | 30-Jul-2024 | 4.3 KiB | 134 | 91 | |
unit1660.c | H A D | 19-Sep-2024 | 5.5 KiB | 181 | 122 | |
unit1661.c | H A D | 22-Sep-2024 | 3.3 KiB | 117 | 52 | |
unit1663.c | H A D | 22-Sep-2024 | 3.1 KiB | 98 | 63 | |
unit2600.c | H A D | 22-Sep-2024 | 12.3 KiB | 405 | 308 | |
unit2601.c | H A D | 03-Oct-2024 | 8.5 KiB | 282 | 223 | |
unit2602.c | H A D | 03-Aug-2023 | 5.5 KiB | 149 | 101 | |
unit2603.c | H A D | 16-Sep-2024 | 5.1 KiB | 195 | 153 | |
unit2604.c | H A D | 31-Oct-2024 | 3.8 KiB | 124 | 85 | |
unit3200.c | H A D | 31-Oct-2024 | 5.4 KiB | 192 | 139 | |
unit3205.c | H A D | 16-Aug-2024 | 32 KiB | 798 | 740 |
README.md
1<!-- 2Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 4SPDX-License-Identifier: curl 5--> 6 7# Unit tests 8 9The goal is to add tests for *all* functions in libcurl. If functions are too 10big and complicated, we should split them into smaller and testable ones. 11 12## Build Unit Tests 13 14`./configure --enable-debug` is required for the unit tests to build. To 15enable unit tests, there will be a separate static libcurl built that will be 16used exclusively for linking unit test programs. Just build everything as 17normal, and then you can run the unit test cases as well. 18 19## Run Unit Tests 20 21Unit tests are run as part of the regular test suite. If you have built 22everything to run unit tests, to can do 'make test' at the root level. Or you 23can `cd tests` and `make` and then invoke individual unit tests with 24`./runtests.pl NNNN` where `NNNN` is the specific test number. 25 26## Debug Unit Tests 27 28If a specific test fails you will get told. The test case then has output left 29in the %LOGDIR subdirectory, but most importantly you can re-run the test again 30using gdb by doing `./runtests.pl -g NNNN`. That is, add a `-g` to make it 31start up gdb and run the same case using that. 32 33## Write Unit Tests 34 35We put tests that focus on an area or a specific function into a single C 36source file. The source file should be named `unitNNNN.c` where `NNNN` is a 37previously unused number. 38 39Add your test to `tests/unit/Makefile.inc` (if it is a unit test). Add your 40test data file name to `tests/data/Makefile.am` 41 42You also need a separate file called `tests/data/testNNNN` (using the same 43number) that describes your test case. See the test1300 file for inspiration 44and the `tests/FILEFORMAT.md` documentation. 45 46For the actual C file, here's a simple example: 47~~~c 48 49 #include "curlcheck.h" 50 51 #include "a libcurl header.h" /* from the lib dir */ 52 53 static CURLcode unit_setup( void ) 54 { 55 /* whatever you want done first */ 56 return CURLE_OK; 57 } 58 59 static void unit_stop( void ) 60 { 61 /* done before shutting down and exiting */ 62 } 63 64 UNITTEST_START 65 66 /* here you start doing things and checking that the results are good */ 67 68 fail_unless( size == 0 , "initial size should be zero" ); 69 fail_if( head == NULL , "head should not be initiated to NULL" ); 70 71 /* you end the test code like this: */ 72 73 UNITTEST_STOP 74