~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/libdrizzle_test.cc

  • Committer: Mark Atwood
  • Date: 2011-12-30 22:59:59 UTC
  • mfrom: (2478.1.3 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111230225959-m3wdvqiymv3a4q2w
mergeĀ lp:~brianaker/drizzle/yacc-merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#define BOOST_TEST_DYN_LINK
24
24
#include <boost/test/unit_test.hpp>
25
25
 
26
 
#include <libdrizzle-2.0/drizzle_client.h>
27
 
#include <libdrizzle-2.0/drizzle_server.h>
 
26
#include <libdrizzle-1.0/drizzle_client.h>
 
27
#include <libdrizzle-1.0/drizzle_server.h>
28
28
 
29
29
BOOST_AUTO_TEST_SUITE(LibDrizzle)
30
30
BOOST_AUTO_TEST_CASE(drizzleEscapeString)
32
32
  const char* orig= "hello \"world\"\n";
33
33
  char out[255];
34
34
 
35
 
  ssize_t out_len= drizzle_escape_string(out, sizeof(out), orig, strlen(orig));
 
35
  ssize_t out_len= drizzle_safe_escape_string(out, sizeof(out), orig, strlen(orig));
36
36
 
37
37
  BOOST_REQUIRE_EQUAL(17, out_len);
38
38
  BOOST_REQUIRE_EQUAL("hello \\\"world\\\"\\n", out);
43
43
  const char orig[6]= {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
44
44
  char out[255];
45
45
 
46
 
  ssize_t out_len= drizzle_escape_string(out, sizeof(out), orig, 6);
 
46
  ssize_t out_len= drizzle_safe_escape_string(out, sizeof(out), orig, 6);
47
47
 
48
48
  BOOST_REQUIRE_EQUAL(7, out_len);
49
49
  BOOST_REQUIRE_EQUAL("\\0\1\2\3\4\5", out);
54
54
  const char* orig= "hello \"world\"\n";
55
55
  char out[255];
56
56
 
57
 
  ssize_t out_len= drizzle_escape_string(out, sizeof(out), orig, strlen(orig));
 
57
  ssize_t out_len= drizzle_safe_escape_string(out, sizeof(out), orig, strlen(orig));
58
58
 
59
59
  BOOST_REQUIRE_EQUAL(17, out_len);
60
60
  BOOST_REQUIRE_EQUAL("hello \\\"world\\\"\\n", out);
65
65
  const char* orig= "hello \"world\"\n";
66
66
  char out[5];
67
67
 
68
 
  ssize_t out_len= drizzle_escape_string(out, sizeof(out), orig, strlen(orig));
 
68
  ssize_t out_len= drizzle_safe_escape_string(out, sizeof(out), orig, strlen(orig));
69
69
 
70
70
  BOOST_REQUIRE_EQUAL(-1, out_len);
71
71
}