LCOV - code coverage report
Current view: top level - lib/tdb/test - run-zero-append.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 14 14 100.0 %
Date: 2024-04-21 15:09:00 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "../common/tdb_private.h"
       2             : #include "../common/io.c"
       3             : #include "../common/tdb.c"
       4             : #include "../common/lock.c"
       5             : #include "../common/freelist.c"
       6             : #include "../common/traverse.c"
       7             : #include "../common/transaction.c"
       8             : #include "../common/error.c"
       9             : #include "../common/open.c"
      10             : #include "../common/check.c"
      11             : #include "../common/hash.c"
      12             : #include "../common/mutex.c"
      13             : #include "tap-interface.h"
      14             : #include <stdlib.h>
      15             : #include "logging.h"
      16             : 
      17           1 : int main(int argc, char *argv[])
      18             : {
      19             :         struct tdb_context *tdb;
      20             :         TDB_DATA key, data;
      21             : 
      22             :         plan_tests(4);
      23           1 :         tdb = tdb_open_ex(NULL, 1024, TDB_INTERNAL, O_CREAT|O_TRUNC|O_RDWR,
      24             :                           0600, &taplogctx, NULL);
      25           1 :         ok1(tdb);
      26             : 
      27             :         /* Tickle bug on appending zero length buffer to zero length buffer. */
      28           1 :         key.dsize = strlen("hi");
      29           1 :         key.dptr = discard_const_p(uint8_t, "hi");
      30           1 :         data.dptr = discard_const_p(uint8_t, "world");
      31           1 :         data.dsize = 0;
      32             : 
      33           1 :         ok1(tdb_append(tdb, key, data) == 0);
      34           1 :         ok1(tdb_append(tdb, key, data) == 0);
      35           1 :         data = tdb_fetch(tdb, key);
      36           1 :         ok1(data.dsize == 0);
      37           1 :         tdb_close(tdb);
      38           1 :         free(data.dptr);
      39             : 
      40           1 :         return exit_status();
      41             : }

Generated by: LCOV version 1.14