~drizzle-trunk/drizzle/development

2465.1.3 by Brian Aker
Include additional libdrizzle tests.
1
/*
2
 * Drizzle Client & Protocol Library
3
 *
4
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 * All rights reserved.
6
 *
2471.1.1 by Mark Atwood
add missing license headers
7
 * 
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions are
10
 * met:
11
 * 
12
 *     * Redistributions of source code must retain the above copyright
13
 * notice, this list of conditions and the following disclaimer.
14
 * 
15
 *     * Redistributions in binary form must reproduce the above
16
 * copyright notice, this list of conditions and the following disclaimer
17
 * in the documentation and/or other materials provided with the
18
 * distribution.
19
 * 
20
 *     * The names of its contributors may not be used to endorse or
21
 * promote products derived from this software without specific prior
22
 * written permission.
23
 * 
24
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2465.1.3 by Brian Aker
Include additional libdrizzle tests.
35
 */
36
37
/**
38
 * @file
39
 * @brief drizzle_result_st tests
40
 */
41
42
#include <libdrizzle-1.0/t/common.h>
43
44
#include <unistd.h>
45
46
int main(void)
47
{
48
  close(STDOUT_FILENO);
49
50
  drizzle_st *drizzle;
51
  drizzle_con_st *con;
52
  drizzle_result_st *result;
53
  drizzle_result_st result_buffer;
54
  drizzle_result_st *clone;
55
56
  printf("sizeof(drizzle_result_st) = %zu\n", sizeof(drizzle_result_st));
57
58
  if ((drizzle= drizzle_create(NULL)) == NULL)
59
    drizzle_test_error("drizzle_create");
60
61
  if ((con= drizzle_con_create(drizzle, NULL)) == NULL)
62
    drizzle_test_error("drizzle_con_create");
63
64
  if ((result= drizzle_result_create(con, &result_buffer)) == NULL)
65
    drizzle_test_error("drizzle_result_create");
66
  drizzle_result_free(result);
67
68
  if ((result= drizzle_result_create(con, NULL)) == NULL)
69
    drizzle_test_error("drizzle_result_create");
70
71
  if ((clone= drizzle_result_clone(con, NULL, result)) == NULL)
72
    drizzle_test_error("drizzle_result_clone");
73
  drizzle_result_free(clone);
74
75
  drizzle_result_set_info(result, "simple test");
76
77
  if (strcmp(drizzle_result_info(result), "simple test"))
78
    drizzle_test_error("drizzle_result_info");
79
80
  drizzle_result_free(result);
81
  drizzle_con_free(con);
82
  drizzle_free(drizzle);
83
84
  return 0;
85
}