~ubuntu-branches/debian/squeeze/protobuf/squeeze

« back to all changes in this revision

Viewing changes to src/google/protobuf/stubs/structurally_valid_unittest.cc

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2009-06-02 16:19:00 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090602161900-vm176i3ryt35yk91
Tags: 2.0.3-2.2
* Non-maintainer upload.
* Fix FTBFS from -2.1: don't fail when we can't clean up the java build,
  such as when openjdk isn't installed.
* Disable parallel builds, because libtool is made of fail (if binary-arch
  and build-indep run concurrently, we relink a library while it's being
  used; that doesn't work so well).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2008 Google Inc. All Rights Reserved.
 
2
// Author: xpeng@google.com (Peter Peng)
 
3
 
 
4
#include <google/protobuf/stubs/common.h>
 
5
#include <gtest/gtest.h>
 
6
 
 
7
namespace google {
 
8
namespace protobuf {
 
9
namespace internal {
 
10
namespace {
 
11
 
 
12
TEST(StructurallyValidTest, ValidUTF8String) {
 
13
  // On GCC, this string can be written as:
 
14
  //   "abcd 1234 - \u2014\u2013\u2212"
 
15
  // MSVC seems to interpret \u differently.
 
16
  string valid_str("abcd 1234 - \342\200\224\342\200\223\342\210\222");
 
17
  EXPECT_TRUE(IsStructurallyValidUTF8(valid_str.data(),
 
18
                                      valid_str.size()));
 
19
}
 
20
 
 
21
TEST(StructurallyValidTest, InvalidUTF8String) {
 
22
  string invalid_str("\xA0\xB0");
 
23
  EXPECT_FALSE(IsStructurallyValidUTF8(invalid_str.data(),
 
24
                                       invalid_str.size()));
 
25
}
 
26
 
 
27
}  // namespace
 
28
}  // namespace internal
 
29
}  // namespace protobuf
 
30
}  // namespace google