~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-1.0/t/drizzle_column_st.c

  • Committer: Brian Aker
  • Date: 2011-12-12 14:29:51 UTC
  • mto: This revision was merged to the branch mainline in revision 2470.
  • Revision ID: brian@tangent.org-20111212142951-akgfh1vn3g9cos2g
Include additional libdrizzle tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Drizzle Client & Protocol Library
 
3
 *
 
4
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
 
5
 * All rights reserved.
 
6
 *
 
7
 * Use and distribution licensed under the BSD license.  See
 
8
 * the COPYING file in this directory for full text.
 
9
 */
 
10
 
 
11
/**
 
12
 * @file
 
13
 * @brief drizzle_column_st tests
 
14
 */
 
15
 
 
16
#include <libdrizzle-1.0/t/common.h>
 
17
 
 
18
#include <unistd.h>
 
19
 
 
20
int main(void)
 
21
{
 
22
  close(STDOUT_FILENO);
 
23
 
 
24
  drizzle_st *drizzle;
 
25
  drizzle_con_st *con;
 
26
  drizzle_result_st *result;
 
27
  drizzle_column_st *column;
 
28
  drizzle_column_st column_buffer;
 
29
 
 
30
  printf("sizeof(drizzle_column_st) = %zu\n", sizeof(drizzle_column_st));
 
31
 
 
32
  drizzle_test("drizzle_create");
 
33
  if ((drizzle= drizzle_create(NULL)) == NULL)
 
34
    drizzle_test_error("returned NULL");
 
35
 
 
36
  drizzle_test("drizzle_con_create");
 
37
  if ((con= drizzle_con_create(drizzle, NULL)) == NULL)
 
38
    drizzle_test_error("returned NULL");
 
39
 
 
40
  drizzle_test("drizzle_result_create");
 
41
  if ((result= drizzle_result_create(con, NULL)) == NULL)
 
42
    drizzle_test_error("returned NULL");
 
43
 
 
44
  drizzle_test("drizzle_column_create buffer");
 
45
  if ((column= drizzle_column_create(result, &column_buffer)) == NULL)
 
46
    drizzle_test_error("returned NULL");
 
47
  drizzle_column_free(column);
 
48
 
 
49
  drizzle_test("drizzle_column_create");
 
50
  if ((column= drizzle_column_create(result, NULL)) == NULL)
 
51
    drizzle_test_error("returned NULL");
 
52
 
 
53
  drizzle_test("drizzle_column_set_catalog");
 
54
  drizzle_column_set_catalog(column, "simple test");
 
55
 
 
56
  drizzle_test("drizzle_column_catalog");
 
57
  if (strcmp(drizzle_column_catalog(column), "simple test"))
 
58
    drizzle_test_error("does not match what was set");
 
59
 
 
60
  drizzle_test("drizzle_column_free");
 
61
  drizzle_column_free(column);
 
62
 
 
63
  drizzle_test("drizzle_result_free");
 
64
  drizzle_result_free(result);
 
65
 
 
66
  drizzle_test("drizzle_con_free");
 
67
  drizzle_con_free(con);
 
68
 
 
69
  drizzle_test("drizzle_free");
 
70
  drizzle_free(drizzle);
 
71
 
 
72
  return 0;
 
73
}