Browse Source

[trac838] also fixed another STL related bugs in tests: avoid using &vector[0]
when the vector can be empty.

JINMEI Tatuya 14 years ago
parent
commit
9c4b079aca
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/lib/util/tests/base32hex_unittest.cc
  2. 1 1
      src/lib/util/tests/base64_unittest.cc

+ 1 - 1
src/lib/util/tests/base32hex_unittest.cc

@@ -66,7 +66,7 @@ decodeCheck(const string& input_string, vector<uint8_t>& output,
             const string& expected)
 {
     decodeBase32Hex(input_string, output);
-    EXPECT_EQ(expected, string(&output[0], &output[0] + output.size()));
+    EXPECT_EQ(expected, string(output.begin(), output.end()));
 }
 
 TEST_F(Base32HexTest, decode) {

+ 1 - 1
src/lib/util/tests/base64_unittest.cc

@@ -52,7 +52,7 @@ decodeCheck(const string& input_string, vector<uint8_t>& output,
             const string& expected)
 {
     decodeBase64(input_string, output);
-    EXPECT_EQ(expected, string(&output[0], &output[0] + output.size()));
+    EXPECT_EQ(expected, string(output.begin(), output.end()));
 }
 
 TEST_F(Base64Test, decode) {