~ubuntu-branches/debian/sid/gearmand/sid

« back to all changes in this revision

Viewing changes to libtest/vchar.cc

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2012-05-01 20:43:47 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20120501204347-qaifvvjkktvc9upu
Tags: 0.32-1
* Imported Upstream version 0.32
* Remove spelling patch included upstream
* Remove documentation patch, we do not rebuild documentation
* Remove memcached patch, fixed upstream
* Use dh_autoreconf
* Use copyright format 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
  return buf.str();
43
43
}
44
44
 
 
45
namespace vchar {
 
46
 
 
47
int compare(libtest::vchar_t& arg, const char *str, size_t length)
 
48
{
 
49
  if (arg.size() == length and (memcmp(&arg[0], str, length) == 0))
 
50
  {
 
51
    return 0;
 
52
  }
 
53
  else if (arg.size() > length)
 
54
  {
 
55
    return 1;
 
56
  }
 
57
 
 
58
  return -1;
 
59
}
 
60
 
 
61
void make(libtest::vchar_t& arg)
 
62
{
 
63
  size_t length= rand() % 1024;
 
64
  make(arg, length);
 
65
}
 
66
 
 
67
void make(libtest::vchar_t& arg, size_t length)
 
68
{
 
69
  for (uint32_t x= 0; x < length; x++)
 
70
  {
 
71
    arg.push_back(char(x % 127));
 
72
  }
 
73
}
 
74
 
 
75
} // namespace vchar
 
76
 
45
77
void make_vector(libtest::vchar_t& arg, const char *str, size_t length)
46
78
{
47
79
  arg.resize(length);