Permalink
Browse files

Switched fully to C++11 hash map/sets.

  • Loading branch information...
jacobsa committed Jan 8, 2014
1 parent d4c5ef1 commit c1f1208ba58e6ba549053695f33df6881e05d1e0
Showing with 9 additions and 53 deletions.
  1. +0 −1 Makefile
  2. +9 −9 gjstest/internal/cpp/run_tests.cc
  3. +0 −1 gjstest/internal/cpp/targets.mk
  4. +0 −36 util/hash/hash.h
  5. +0 −5 util/hash/targets.mk
  6. +0 −1 webutil/xml/targets.mk
View
@@ -50,7 +50,6 @@ include gjstest/public/targets.mk
include strings/targets.mk
include third_party/cityhash/targets.mk
include util/gtl/targets.mk
-include util/hash/targets.mk
include webutil/xml/targets.mk
######################################################
@@ -16,6 +16,7 @@
#include "gjstest/internal/cpp/run_tests.h"
#include <string>
+#include <unordered_map>
#include <vector>
#include <re2/re2.h>
@@ -33,7 +34,6 @@
#include "gjstest/internal/proto/named_scripts.pb.h"
#include "strings/strutil.h"
#include "util/gtl/map_util.h"
-#include "util/hash/hash.h"
#include "webutil/xml/xml_writer.h"
using v8::Array;
@@ -80,8 +80,8 @@ static const char kCoverageExtractionJs[] =
static string MakeXml(
uint32 duration_ms,
const vector<string>& tests_run,
- const hash_map<string, double>& test_durations,
- const hash_map<string, string>& test_failure_messages) {
+ const std::unordered_map<string, double>& test_durations,
+ const std::unordered_map<string, string>& test_failure_messages) {
webutil_xml::XmlWriter xml_writer("UTF-8", true);
xml_writer.StartDocument("UTF-8");
@@ -134,8 +134,8 @@ static void ProcessTestCase(
const Handle<Function>& test_function,
bool* success,
string* output,
- hash_map<string, string>* test_failure_messages,
- hash_map<string, double>* test_durations) {
+ std::unordered_map<string, string>* test_failure_messages,
+ std::unordered_map<string, double>* test_durations) {
// Run the test.
TestCase test_case(test_function);
test_case.Run();
@@ -175,8 +175,8 @@ static void ProcessTestSuite(
bool* success,
string* output,
vector<string>* tests_run,
- hash_map<string, string>* test_failure_messages,
- hash_map<string, double>* test_durations) {
+ std::unordered_map<string, string>* test_failure_messages,
+ std::unordered_map<string, double>* test_durations) {
StringAppendF(output, "[----------]\n");
const Local<Array> test_names = test_functions->GetPropertyNames();
@@ -239,8 +239,8 @@ bool RunTests(
// Keep maps from test name to failure message (if the test failed) and
// duration in seconds.
- hash_map<string, string> test_failure_messages;
- hash_map<string, double> test_durations;
+ std::unordered_map<string, string> test_failure_messages;
+ std::unordered_map<string, double> test_durations;
vector<string> tests_run;
// Keep track of how long the whole process takes, and whether there are any
@@ -27,7 +27,6 @@ $(eval $(call cc_library, \
gjstest/internal/proto/named_scripts.pb \
strings/strutil \
util/gtl/map_util \
- util/hash/hash \
webutil/xml/xml_writer \
))
View
@@ -1,36 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-// Author: jacobsa@google.com (Aaron Jacobs)
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Helper code that makes hash_map and hash_set usable.
-
-#ifndef UTIL_HASH_HASH_H_
-#define UTIL_HASH_HASH_H_
-
-#include "base/stl_decl.h"
-#include "third_party/cityhash/city.h"
-
-namespace HASH_NAMESPACE {
-
-// Make sure hash<string> is available.
-template<>
-struct hash<string> {
- size_t operator()(const string& s) const {
- return CityHash64(s.data(), s.size());
- }
-};
-
-} // namespace HASH_NAMESPACE
-
-#endif // UTIL_HASH_HASH_H_
View
@@ -1,5 +0,0 @@
-$(eval $(call hdr_only_cc_library, \
- util/hash/hash, \
- base/stl_decl \
- third_party/cityhash/city \
-))
View
@@ -6,7 +6,6 @@ $(eval $(call cc_library, \
base/scoped_ptr \
base/stl_decl \
base/stringprintf \
- util/hash/hash \
))
######################################################

0 comments on commit c1f1208

Please sign in to comment.