File: bson_new.c

package info (click to toggle)
libmongo-client 0.1.8-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,440 kB
  • sloc: ansic: 14,980; makefile: 317; perl: 137; sh: 48
file content (28 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "bson.h"
#include "test.h"
#include "tap.h"

#include <string.h>

void
test_bson_new (void)
{
  bson *b;

  ok ((b = bson_new ()) != NULL, "bson_new() works");
  ok (bson_data (b) == NULL,
      "bson_data() with an unfished object should fail");
  ok (bson_size (b) == -1,
      "bson_size() with an unfinished object should fail");
  ok (bson_finish (b), "bson_finish() works");
  ok (bson_finish (b),
      "bson_finish() works on an already finished object too");
  bson_free (b);

  ok (bson_size (NULL) == -1, "bson_size(NULL) works correctly");
  ok (bson_data (NULL) == NULL, "bson_data(NULL) works correctly");
  ok (bson_finish (NULL) == FALSE, "bson_finish(NULL) works correctly");
  bson_free (NULL);
}

RUN_TEST (8, bson_new);