~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/libdrizzle_test.cc

  • Committer: Monty Taylor
  • Date: 2011-03-15 16:10:15 UTC
  • mfrom: (2235.3.1 staging)
  • Revision ID: mordred@inaugust.com-20110315161015-qceggirmf3cct7cw
Merge in libdrizzle install changes, doc changes and some header
refactoring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
  BOOST_REQUIRE_EQUAL("\\0\1\2\3\4\5", out);
52
52
}
53
53
 
 
54
BOOST_AUTO_TEST_CASE(drizzleSafeEscapeString)
 
55
{
 
56
  const char* orig= "hello \"world\"\n";
 
57
  char out[255];
 
58
  ssize_t out_len;
 
59
 
 
60
  out_len= drizzle_safe_escape_string(out, 255, orig, strlen(orig));
 
61
 
 
62
  BOOST_REQUIRE_EQUAL(17, out_len);
 
63
  BOOST_REQUIRE_EQUAL("hello \\\"world\\\"\\n", out);
 
64
}
 
65
 
 
66
BOOST_AUTO_TEST_CASE(drizzleSafeEscapeStringFail)
 
67
{
 
68
  const char* orig= "hello \"world\"\n";
 
69
  char out[5];
 
70
  ssize_t out_len;
 
71
 
 
72
  out_len= drizzle_safe_escape_string(out, 5, orig, strlen(orig));
 
73
 
 
74
  BOOST_REQUIRE_EQUAL(-1, out_len);
 
75
}
54
76
 
55
77
BOOST_AUTO_TEST_CASE(drizzleHexString)
56
78
{