瀏覽代碼

Improve testing reliability.

Sam Jaffe 4 年之前
父節點
當前提交
07f3b74c0a

+ 11 - 7
iterator.xcodeproj/project.pbxproj

@@ -60,6 +60,7 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		CD3C6DDB26238F8F00548B64 /* xcode_gtest_helper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xcode_gtest_helper.h; sourceTree = "<group>"; };
 		CDCB3BBC24E1CDE40029B771 /* iterator */ = {isa = PBXFileReference; lastKnownFileType = folder; name = iterator; path = include/iterator; sourceTree = "<group>"; };
 		CDCB3BC124E1D3880029B771 /* iterator-test.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iterator-test.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
 		CDCB3BC524E1D3880029B771 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -112,6 +113,7 @@
 		CD21AE271E4A3E8600536178 /* test */ = {
 			isa = PBXGroup;
 			children = (
+				CD3C6DDB26238F8F00548B64 /* xcode_gtest_helper.h */,
 				CDCB3BD224E1D5320029B771 /* end_aware_iterator_test.cxx */,
 				CDCB3BD324E1D5320029B771 /* filter_iterator_test.cxx */,
 				CDCB3BD424E1D5320029B771 /* indexed_iterator_test.cxx */,
@@ -180,7 +182,7 @@
 		CD21AE151E4A3E7900536178 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 1110;
+				LastUpgradeCheck = 1230;
 				ORGANIZATIONNAME = "Sam Jaffe";
 				TargetAttributes = {
 					CDCB3BC024E1D3880029B771 = {
@@ -289,7 +291,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
@@ -307,6 +309,7 @@
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
 				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -344,7 +347,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
@@ -362,6 +365,7 @@
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
 				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -392,7 +396,7 @@
 			buildSettings = {
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CLANG_ENABLE_OBJC_WEAK = YES;
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
 				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
@@ -401,7 +405,7 @@
 				GCC_C_LANGUAGE_STANDARD = gnu11;
 				INFOPLIST_FILE = "iterator-test/Info.plist";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.14;
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
 				MTL_FAST_MATH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = "leumasjaffe.iterator-test";
@@ -414,7 +418,7 @@
 			buildSettings = {
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++17";
 				CLANG_ENABLE_OBJC_WEAK = YES;
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
 				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
@@ -423,7 +427,7 @@
 				GCC_C_LANGUAGE_STANDARD = gnu11;
 				INFOPLIST_FILE = "iterator-test/Info.plist";
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
-				MACOSX_DEPLOYMENT_TARGET = 10.14;
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				MTL_FAST_MATH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = "leumasjaffe.iterator-test";
 				PRODUCT_NAME = "$(TARGET_NAME)";

+ 1 - 1
iterator.xcodeproj/xcshareddata/xcschemes/iterator-test.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "1130"
+   LastUpgradeVersion = "1240"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
test/end_aware_iterator_test.cxx

@@ -2,7 +2,7 @@
 
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 using end_aware_iterator =
     ::iterator::end_aware_iterator<std::vector<int>::iterator>;

+ 1 - 1
test/filter_iterator_test.cxx

@@ -2,7 +2,7 @@
 
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(FilterIteratorTest, CanPerformSkipsOnData) {
   std::vector<int> const data = {1, 2, 3, 4, 5};

+ 1 - 1
test/indexed_iterator_test.cxx

@@ -3,7 +3,7 @@
 #include <map>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 #include "iterator/end_aware_iterator.hpp"
 

+ 1 - 1
test/join_iterator_test.cxx

@@ -2,7 +2,7 @@
 
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 using join_iterator =
     iterator::joining_iterator<std::vector<std::vector<int>>::iterator>;

+ 1 - 1
test/recursive_iterator_accessors_test.cxx

@@ -5,7 +5,7 @@
 #include <tuple>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(RecursiveIteratorTest, DoesNotUnwrapString) {
   std::vector<std::string> obj{"A", "B", "C", "D"};

+ 1 - 1
test/recursive_iterator_map_test.cxx

@@ -4,7 +4,7 @@
 #include <tuple>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(RecursiveIteratorMapTest, PreIncrementAdvancesIterator) {
   std::map<int, std::map<int, std::map<int, int>>> const map{

+ 1 - 1
test/recursive_iterator_mixed_container_test.cxx

@@ -3,7 +3,7 @@
 #include <map>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(RecursiveIteratorMapVectorTest, IterDistanceIsSumOfInnerContainerSizes) {
   std::map<int, std::vector<int>> const obj{{1, {1, 2}}, {2, {3, 4, 5}}};

+ 1 - 1
test/recursive_iterator_single_level_test.cxx

@@ -11,7 +11,7 @@
 #include <map>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(RecursiveIteratorSingleVectorTest, IterDistanceIsContainerSize) {
   std::vector<int> const vec{1, 2, 3, 4, 5};

+ 1 - 1
test/recursive_iterator_vector_test.cxx

@@ -2,7 +2,7 @@
 
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(RecursiveIteratorVecTest, PreIncrementAdvancesIterator) {
   std::vector<std::vector<std::vector<int>>> const vec{{{1, 2}}, {{3}, {4, 5}}};

+ 1 - 1
test/unkeyed_iterator_test.cxx

@@ -3,7 +3,7 @@
 #include <map>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 #include "iterator/end_aware_iterator.hpp"
 

+ 38 - 0
test/xcode_gtest_helper.h

@@ -0,0 +1,38 @@
+//
+//  xcode_gtest_helper.h
+//  tax-calculator-test
+//
+//  Created by Sam Jaffe on 11/25/20.
+//  Copyright © 2020 Sam Jaffe. All rights reserved.
+//
+
+#pragma once
+
+#if defined(__APPLE__)
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#pragma clang diagnostic pop
+
+#if defined(TARGET_OS_OSX)
+// This is a hack to allow XCode to properly display failures when running
+// unit tests.
+#undef EXPECT_THAT
+#define EXPECT_THAT ASSERT_THAT
+#undef EXPECT_THROW
+#define EXPECT_THROW ASSERT_THROW
+#undef EXPECT_ANY_THROW
+#define EXPECT_ANY_THROW ASSERT_ANY_THROW
+#undef EXPECT_NO_THROW
+#define EXPECT_NO_THROW ASSERT_NO_THROW
+#undef EXPECT_TRUE
+#define EXPECT_TRUE ASSERT_TRUE
+#undef EXPECT_FALSE
+#define EXPECT_FALSE ASSERT_FALSE
+
+#endif
+#endif

+ 1 - 1
test/zip_iterator_test.cxx

@@ -12,7 +12,7 @@
 #include <list>
 #include <vector>
 
-#include <gmock/gmock.h>
+#include "xcode_gtest_helper.h"
 
 TEST(ZipIteratorTest, CategoryIsMostRestrictiveOfTypes) {
   std::vector<int> rnd{1, 2, 3};