~ubuntu-branches/debian/stretch/protobuf/stretch

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Robert S. Edmonds
  • Date: 2014-09-11 22:50:10 UTC
  • mfrom: (10.1.9 experimental)
  • Revision ID: package-import@ubuntu.com-20140911225010-wt4yo9dpc1fzuq5g
Tags: 2.6.0-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
  // Set the locale to "C".
52
52
  ASSERT_TRUE(setlocale(LC_NUMERIC, "C") != NULL);
53
53
 
54
 
  EXPECT_EQ(1.5, NoLocaleStrtod("1.5", NULL));
55
54
  EXPECT_EQ("1.5", SimpleDtoa(1.5));
56
55
  EXPECT_EQ("1.5", SimpleFtoa(1.5));
57
56
 
58
 
  // Verify that the endptr is set correctly even if not all text was parsed.
59
 
  const char* text = "1.5f";
60
 
  char* endptr;
61
 
  EXPECT_EQ(1.5, NoLocaleStrtod(text, &endptr));
62
 
  EXPECT_EQ(3, endptr - text);
63
 
 
64
57
  if (setlocale(LC_NUMERIC, "es_ES") == NULL &&
65
58
      setlocale(LC_NUMERIC, "es_ES.utf8") == NULL) {
66
59
    // Some systems may not have the desired locale available.
67
60
    GOOGLE_LOG(WARNING)
68
61
      << "Couldn't set locale to es_ES.  Skipping this test.";
69
62
  } else {
70
 
    EXPECT_EQ(1.5, NoLocaleStrtod("1.5", NULL));
71
63
    EXPECT_EQ("1.5", SimpleDtoa(1.5));
72
64
    EXPECT_EQ("1.5", SimpleFtoa(1.5));
73
 
    EXPECT_EQ(1.5, NoLocaleStrtod(text, &endptr));
74
 
    EXPECT_EQ(3, endptr - text);
75
65
  }
76
66
 
77
67
  // Return to original locale.