Browse Source

Convert to GoogleTest. Discard Makefile.

Sam Jaffe 6 years ago
parent
commit
3a886c91aa

+ 0 - 75
Makefile

@@ -1,75 +0,0 @@
-WARNINGS := -Wall -pedantic  -pedantic-errors -Wextra -Wcast-align \
-  -Wcast-qual  -Wchar-subscripts  -Wcomment -Wconversion \
-  -Wdisabled-optimization -Werror -Wfloat-equal  -Wformat  -Wformat=2 \
-  -Wformat-nonliteral -Wformat-security  -Wformat-y2k \
-  -Wimport  -Winit-self  -Winline -Winvalid-pch   \
-  -Wunsafe-loop-optimizations  -Wno-long-long -Wmissing-braces \
-  -Wmissing-field-initializers -Wmissing-format-attribute   \
-  -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-declarations \
-  -Wpacked -Wparentheses  -Wpointer-arith \
-  -Wredundant-decls -Wreturn-type \
-  -Wsequence-point  -Wshadow -Wsign-compare  -Wstack-protector \
-  -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch  -Wswitch-default \
-  -Wswitch-enum -Wtrigraphs  -Wuninitialized \
-  -Wunknown-pragmas  -Wunreachable-code -Wunused \
-  -Wunused-function  -Wunused-label  -Wunused-parameter \
-  -Wunused-value  -Wunused-variable  -Wvariadic-macros \
-  -Wvolatile-register-var  -Wwrite-strings
-
-CWARNINGS := $(WARNINGS) -Wimplicit
-CPPWARNINGS := $(WARNINGS)
-
-CFLAGS   := $(CWARNINGS)
-CPPFLAGS := $(CPPWARNINGS) --std=c++11
-LDFLAGS  :=
-
-HDRFILES := rotate.hpp
-SRCFILES := 
-TSTSUITE := rotate_tc.h
-
-BINARY   :=
-
-DEPFILES := $(patsubst %.cpp,.%.d,$(SRCFILES))
-OBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
-TSTFILES := $(patsubst %.h,%.cpp,$(TSTSUITE))
-TSTDRIVR := $(patsubst %.cpp,%,$(TSTFILES))
-
-ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
-
-.PHONY: all clean debug release check coverage
-
-all: $(BINARY) $(LNBINARY)
-
-debug: CFLAGS += -DDEBUG -g
-debug: CPPFLAGS += -DDEBUG -g
-debug: all
-
-release: CFLAGS += -O2
-release: CPPFLAGS += -O2
-release: all
-
-coverage: CFLAGS += -fprofile-arcs -ftest-coverage
-coverage: CPPFLAGS += -fprofile-arcs -ftest-coverage
-coverage: check
-
-clean: check-clean
-	@$(RM) $(BINARY) $(wildcard $(OBJFILES)) $(LNBINARY)
-
-check-clean:
-	@$(RM) $(TSTDRIVR) $(TSTFILES)
-
-check: check-clean $(TSTDRIVR)
-
-.h.cpp:
-	@cxxtestgen --error-printer $< -o $@
-
-.cpp.o: Makefile
-	$(CXX) $(CPPFLAGS) -MMD -MP -MF $(patsubst %.cpp,.%.d,$<) -c $< -o $@
-
-$(BINARY): $(OBJFILES) 
-	$(CXX) $(LDFLAGS) -o $@ $(OBJFILES)
-
-$(TSTDRIVR): $(TSTFILES)
-	@$(CXX) $(CPPFLAGS) -I$(CXXTEST) -w $@.cpp -o $@
-	@echo Running TestDriver: ./$@
-	@./$@

rotate.hpp → include/rotate/rotate.hpp


+ 22 - 0
rotate-test/Info.plist

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

+ 0 - 124
rotate.t.h

@@ -1,124 +0,0 @@
-//
-//  rotate_tc.h
-//  datamodel
-//
-//  Created by Sam Jaffe on 9/30/15.
-//
-//
-
-#include <cxxtest/TestSuite.h>
-
-#include "rotate.hpp"
-
-struct Point {
-  float x = 0.f, y = 0.f;
-  
-  Point() = default;
-  Point(float _x, float _y) : x(_x), y(_y) {}
-  
-  bool operator==(const Point& other) const {
-    return !memcmp(this, &other, sizeof(*this));
-  }
-};
-
-struct Dimension {
-  float width = 0.f, height = 0.f;
-  
-  Dimension() = default;
-  Dimension(float w, float h) : width(w), height(h) {}
-  
-  bool operator==(const Dimension& other) const {
-    return !memcmp(this, &other, sizeof(*this));
-  }
-};
-
-struct Material {
-  int id = -1;
-  
-  Material() = default;
-  Material(int i) : id(i) {}
-  
-  bool operator==(const Material& other) const {
-    return !memcmp(this, &other, sizeof(*this));
-  }
-};
-
-struct RenderInfo {
-  Point center;
-  Material material;
-  Dimension texture_size, object_size;
-  Point bottom_left, bottom_right, top_right, top_left;
-  float rotation = 0.0f; // TODO
-  
-  RenderInfo(Point c, Dimension sz, Material mat = {0}, Dimension tx_sz = {1.f, 1.f})
-  : center(c)
-  , material(mat)
-  , texture_size(tx_sz)
-  , object_size(sz)
-  , bottom_left ({c.x - sz.width / 2.f, c.y - sz.height / 2.f})
-  , bottom_right({c.x - sz.width / 2.f, c.y + sz.height / 2.f})
-  , top_right   ({c.x + sz.width / 2.f, c.y + sz.height / 2.f})
-  , top_left    ({c.x + sz.width / 2.f, c.y - sz.height / 2.f})
-  {
-    
-  }
-  
-  RenderInfo() = default;
-  
-  bool operator==(const RenderInfo& other) const {
-    return !memcmp(this, &other, sizeof(*this));
-  }
-};
-
-DEFINE_ROTATE(RenderInfo, (material)(texture_size)(bottom_left)(bottom_right)(top_right)(top_left));
-
-DEFINE_ROTATE_NAME(simple_rotate, RenderInfo, (material)(texture_size)(center)(object_size));
-
-DEFINE_PROXY_NAME( RenderInfo_position_proxy, RenderInfo, (center)(object_size) );
-DEFINE_PROXY_CONVERSION( RenderInfo, (material)(texture_size)(center)(object_size), (center)(object_size) );
-
-class rotate_TestSuite : public CxxTest::TestSuite {
-public:
-  void test_proxy1() const {
-    RenderInfo_rotate rdata;
-    RenderInfo info{{5, 6}, {1, 1}};
-    rdata.push_back(info);
-    RenderInfo_proxy proxy = rdata.get(0);
-    TS_ASSERT_EQUALS(info.texture_size, proxy.texture_size);
-    TS_ASSERT_EQUALS(info.bottom_left, proxy.bottom_left);
-    TS_ASSERT_EQUALS(info.bottom_right, proxy.bottom_right);
-    TS_ASSERT_EQUALS(info.top_left, proxy.top_left);
-    TS_ASSERT_EQUALS(info.top_right, proxy.top_right);
-  }
-  
-  void test_proxy2() const {
-    simple_rotate rdata;
-    RenderInfo info{{5, 6}, {1, 1}};
-    rdata.push_back(info);
-    simple_rotate_proxy proxy = rdata.get(0);
-    TS_ASSERT_EQUALS(info.texture_size, proxy.texture_size);
-    TS_ASSERT_EQUALS(info.center, proxy.center);
-    TS_ASSERT_EQUALS(info.object_size, proxy.object_size);
-  }
-
-  void test_datamodel_center() const {
-    simple_rotate rdata;
-    RenderInfo infos[3] = {{{1,2},{1,1}},{{0,3},{1,1}},{{4,3.2f},{1,1}}};
-    rdata.push_back(infos[0]);
-    rdata.push_back(infos[1]);
-    rdata.push_back(infos[2]);
-    TS_ASSERT_EQUALS(rdata.get(access_t(RenderInfo, center){}), (std::vector<Point>{{1,2},{0,3},{4,3.2f}}));
-  }
-  
-  void test_datamodel_multiproxy() const {
-    simple_rotate rdata;
-    RenderInfo info{{5, 6}, {1, 1}};
-    rdata.push_back(info);
-    RenderInfo_position_proxy proxy = rdata.getp<rotate_members(RenderInfo, (center)(object_size))>(0);
-    TS_ASSERT_EQUALS( sizeof(proxy), sizeof(Point&)+sizeof(Dimension&) );
-    TS_ASSERT_EQUALS(info.center, proxy.center);
-    TS_ASSERT_EQUALS(info.object_size, proxy.object_size);
-  }
-private:
-  
-};

+ 170 - 148
rotate.xcodeproj/project.pbxproj

@@ -7,34 +7,55 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		CD0C76D01E2AB8F10096E269 /* rotate_tc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */; };
+		CDB3AEF0230AE3670015D09E /* rotate_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0E9E98B61BBC8A35004FFE25 /* rotate_test.cpp */; };
+		CDB3AEF2230AE44D0015D09E /* GoogleMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDB3AEDB230AE2DE0015D09E /* GoogleMock.framework */; };
 /* End PBXBuildFile section */
 
-/* Begin PBXCopyFilesBuildPhase section */
-		CD0C76C61E2AB8DF0096E269 /* CopyFiles */ = {
-			isa = PBXCopyFilesBuildPhase;
-			buildActionMask = 2147483647;
-			dstPath = /usr/share/man/man1/;
-			dstSubfolderSpec = 0;
-			files = (
-			);
-			runOnlyForDeploymentPostprocessing = 1;
+/* Begin PBXContainerItemProxy section */
+		CDB3AEDA230AE2DE0015D09E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 05818F861A685AEA0072A469;
+			remoteInfo = GoogleMock;
+		};
+		CDB3AEDC230AE2DE0015D09E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 05E96ABD1A68600C00204102;
+			remoteInfo = gmock;
+		};
+		CDB3AEDE230AE2DE0015D09E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 05E96B1F1A68634900204102;
+			remoteInfo = gtest;
+		};
+		CDB3AEE0230AE2DE0015D09E /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 05818F901A685AEA0072A469;
+			remoteInfo = GoogleMockTests;
 		};
-/* End PBXCopyFilesBuildPhase section */
+/* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
-		0E9E98B11BBC8A02004FFE25 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
-		0E9E98B21BBC8A03004FFE25 /* rotate.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = rotate.hpp; sourceTree = "<group>"; };
-		0E9E98B61BBC8A35004FFE25 /* rotate.t.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rotate.t.h; sourceTree = "<group>"; };
-		0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rotate_tc.cpp; sourceTree = "<group>"; };
-		CD0C76C81E2AB8DF0096E269 /* rotate_tc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rotate_tc; sourceTree = BUILT_PRODUCTS_DIR; };
+		0E9E98B61BBC8A35004FFE25 /* rotate_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = rotate_test.cpp; sourceTree = "<group>"; };
+		CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GoogleMock.xcodeproj; path = "../../../../gmock-xcode-master/GoogleMock.xcodeproj"; sourceTree = "<group>"; };
+		CDB3AEE3230AE32A0015D09E /* rotate */ = {isa = PBXFileReference; lastKnownFileType = folder; name = rotate; path = include/rotate; sourceTree = "<group>"; };
+		CDB3AEE8230AE35D0015D09E /* rotate-test.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "rotate-test.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+		CDB3AEEC230AE35D0015D09E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
-		CD0C76C51E2AB8DF0096E269 /* Frameworks */ = {
+		CDB3AEE5230AE35D0015D09E /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				CDB3AEF2230AE44D0015D09E /* GoogleMock.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -44,59 +65,76 @@
 		0E9E98AB1BBC8A02004FFE25 = {
 			isa = PBXGroup;
 			children = (
-				0E9E98B11BBC8A02004FFE25 /* Makefile */,
-				0E9E98B21BBC8A03004FFE25 /* rotate.hpp */,
-				0E9E98B61BBC8A35004FFE25 /* rotate.t.h */,
-				0E9E98B71BBC8DB8004FFE25 /* rotate_tc.cpp */,
+				CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */,
+				CDB3AEE3230AE32A0015D09E /* rotate */,
+				CDB3AEE2230AE2F90015D09E /* test */,
+				CDB3AEE9230AE35D0015D09E /* rotate-test */,
 				CD0C76C91E2AB8DF0096E269 /* Products */,
+				CDB3AEF1230AE44D0015D09E /* Frameworks */,
 			);
 			sourceTree = "<group>";
 		};
 		CD0C76C91E2AB8DF0096E269 /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				CD0C76C81E2AB8DF0096E269 /* rotate_tc */,
+				CDB3AEE8230AE35D0015D09E /* rotate-test.xctest */,
 			);
 			name = Products;
 			sourceTree = "<group>";
 		};
-/* End PBXGroup section */
-
-/* Begin PBXLegacyTarget section */
-		0E9E98B01BBC8A02004FFE25 /* rotate */ = {
-			isa = PBXLegacyTarget;
-			buildArgumentsString = "$(ACTION)";
-			buildConfigurationList = 0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "rotate" */;
-			buildPhases = (
+		CDB3AED4230AE2DE0015D09E /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				CDB3AEDB230AE2DE0015D09E /* GoogleMock.framework */,
+				CDB3AEDD230AE2DE0015D09E /* gmock.framework */,
+				CDB3AEDF230AE2DE0015D09E /* gtest.framework */,
+				CDB3AEE1230AE2DE0015D09E /* GoogleMockTests.xctest */,
 			);
-			buildToolPath = /usr/bin/make;
-			buildWorkingDirectory = "/Users/leumasjaffe/Documents/Programming/XTools Workspace/C:C++/misc/datamodel";
-			dependencies = (
+			name = Products;
+			sourceTree = "<group>";
+		};
+		CDB3AEE2230AE2F90015D09E /* test */ = {
+			isa = PBXGroup;
+			children = (
+				0E9E98B61BBC8A35004FFE25 /* rotate_test.cpp */,
+			);
+			path = test;
+			sourceTree = "<group>";
+		};
+		CDB3AEE9230AE35D0015D09E /* rotate-test */ = {
+			isa = PBXGroup;
+			children = (
+				CDB3AEEC230AE35D0015D09E /* Info.plist */,
+			);
+			path = "rotate-test";
+			sourceTree = "<group>";
+		};
+		CDB3AEF1230AE44D0015D09E /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
 			);
-			name = rotate;
-			passBuildSettingsInEnvironment = 1;
-			productName = datamodel;
+			name = Frameworks;
+			sourceTree = "<group>";
 		};
-/* End PBXLegacyTarget section */
+/* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		CD0C76C71E2AB8DF0096E269 /* rotate_tc */ = {
+		CDB3AEE7230AE35D0015D09E /* rotate-test */ = {
 			isa = PBXNativeTarget;
-			buildConfigurationList = CD0C76CF1E2AB8DF0096E269 /* Build configuration list for PBXNativeTarget "rotate_tc" */;
+			buildConfigurationList = CDB3AEED230AE35D0015D09E /* Build configuration list for PBXNativeTarget "rotate-test" */;
 			buildPhases = (
-				CD0C76D11E2AC29B0096E269 /* ShellScript */,
-				CD0C76C41E2AB8DF0096E269 /* Sources */,
-				CD0C76C51E2AB8DF0096E269 /* Frameworks */,
-				CD0C76C61E2AB8DF0096E269 /* CopyFiles */,
+				CDB3AEE4230AE35D0015D09E /* Sources */,
+				CDB3AEE5230AE35D0015D09E /* Frameworks */,
+				CDB3AEE6230AE35D0015D09E /* Resources */,
 			);
 			buildRules = (
 			);
 			dependencies = (
 			);
-			name = rotate_tc;
-			productName = rotate_tc;
-			productReference = CD0C76C81E2AB8DF0096E269 /* rotate_tc */;
-			productType = "com.apple.product-type.tool";
+			name = "rotate-test";
+			productName = "rotate-test";
+			productReference = CDB3AEE8230AE35D0015D09E /* rotate-test.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
 		};
 /* End PBXNativeTarget section */
 
@@ -106,8 +144,9 @@
 			attributes = {
 				LastUpgradeCheck = 1000;
 				TargetAttributes = {
-					CD0C76C71E2AB8DF0096E269 = {
-						CreatedOnToolsVersion = 7.2.1;
+					CDB3AEE7230AE35D0015D09E = {
+						CreatedOnToolsVersion = 10.3;
+						ProvisioningStyle = Automatic;
 					};
 				};
 			};
@@ -122,38 +161,66 @@
 			mainGroup = 0E9E98AB1BBC8A02004FFE25;
 			productRefGroup = CD0C76C91E2AB8DF0096E269 /* Products */;
 			projectDirPath = "";
+			projectReferences = (
+				{
+					ProductGroup = CDB3AED4230AE2DE0015D09E /* Products */;
+					ProjectRef = CDB3AED3230AE2DE0015D09E /* GoogleMock.xcodeproj */;
+				},
+			);
 			projectRoot = "";
 			targets = (
-				0E9E98B01BBC8A02004FFE25 /* rotate */,
-				CD0C76C71E2AB8DF0096E269 /* rotate_tc */,
+				CDB3AEE7230AE35D0015D09E /* rotate-test */,
 			);
 		};
 /* End PBXProject section */
 
-/* Begin PBXShellScriptBuildPhase section */
-		CD0C76D11E2AC29B0096E269 /* ShellScript */ = {
-			isa = PBXShellScriptBuildPhase;
+/* Begin PBXReferenceProxy section */
+		CDB3AEDB230AE2DE0015D09E /* GoogleMock.framework */ = {
+			isa = PBXReferenceProxy;
+			fileType = wrapper.framework;
+			path = GoogleMock.framework;
+			remoteRef = CDB3AEDA230AE2DE0015D09E /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		CDB3AEDD230AE2DE0015D09E /* gmock.framework */ = {
+			isa = PBXReferenceProxy;
+			fileType = wrapper.framework;
+			path = gmock.framework;
+			remoteRef = CDB3AEDC230AE2DE0015D09E /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		CDB3AEDF230AE2DE0015D09E /* gtest.framework */ = {
+			isa = PBXReferenceProxy;
+			fileType = wrapper.framework;
+			path = gtest.framework;
+			remoteRef = CDB3AEDE230AE2DE0015D09E /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		CDB3AEE1230AE2DE0015D09E /* GoogleMockTests.xctest */ = {
+			isa = PBXReferenceProxy;
+			fileType = wrapper.cfbundle;
+			path = GoogleMockTests.xctest;
+			remoteRef = CDB3AEE0230AE2DE0015D09E /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+		CDB3AEE6230AE35D0015D09E /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
 			);
-			inputPaths = (
-				"$(SRCROOT)/rotate.t.h",
-			);
-			outputPaths = (
-				"$(SRCROOT)/rotate_tc.cpp",
-			);
 			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "cxxtestgen --error-printer -o rotate_tc.cpp rotate.t.h";
 		};
-/* End PBXShellScriptBuildPhase section */
+/* End PBXResourcesBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
-		CD0C76C41E2AB8DF0096E269 /* Sources */ = {
+		CDB3AEE4230AE35D0015D09E /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				CD0C76D01E2AB8F10096E269 /* rotate_tc.cpp in Sources */,
+				CDB3AEF0230AE3670015D09E /* rotate_test.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -192,6 +259,8 @@
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = macosx;
+				SYSTEM_HEADER_SEARCH_PATHS = /opt/local/include/;
+				USER_HEADER_SEARCH_PATHS = ./include/;
 			};
 			name = Debug;
 		};
@@ -225,118 +294,80 @@
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				SDKROOT = macosx;
+				SYSTEM_HEADER_SEARCH_PATHS = /opt/local/include/;
+				USER_HEADER_SEARCH_PATHS = ./include/;
 			};
 			name = Release;
 		};
-		0E9E98B41BBC8A03004FFE25 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				CLANG_ENABLE_OBJC_WEAK = YES;
-				COPY_PHASE_STRIP = NO;
-				DEBUGGING_SYMBOLS = YES;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = rotate;
-			};
-			name = Debug;
-		};
-		0E9E98B51BBC8A03004FFE25 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				CLANG_ENABLE_OBJC_WEAK = YES;
-				COPY_PHASE_STRIP = YES;
-				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = rotate;
-			};
-			name = Release;
-		};
-		CD0C76CD1E2AB8DF0096E269 /* Debug */ = {
+		CDB3AEEE230AE35D0015D09E /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
 				CODE_SIGN_IDENTITY = "-";
+				CODE_SIGN_STYLE = Automatic;
+				COMBINE_HIDPI_IMAGES = YES;
 				DEBUG_INFORMATION_FORMAT = dwarf;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				ENABLE_TESTABILITY = YES;
-				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
 				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					"DEBUG=1",
 					"$(inherited)",
 				);
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				HEADER_SEARCH_PATHS = (
-					/usr/local/include,
-					/opt/local/include,
-				);
-				MACOSX_DEPLOYMENT_TARGET = 10.10;
-				MTL_ENABLE_DEBUG_INFO = YES;
+				INFOPLIST_FILE = "rotate-test/Info.plist";
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
+				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+				MTL_FAST_MATH = YES;
+				PRODUCT_BUNDLE_IDENTIFIER = "leumasjaffe.rotate-test";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx;
 			};
 			name = Debug;
 		};
-		CD0C76CE1E2AB8DF0096E269 /* Release */ = {
+		CDB3AEEF230AE35D0015D09E /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
 				CLANG_CXX_LIBRARY = "libc++";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
-				CLANG_WARN_BOOL_CONVERSION = YES;
-				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-				CLANG_WARN_EMPTY_BODY = YES;
-				CLANG_WARN_ENUM_CONVERSION = YES;
-				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-				CLANG_WARN_UNREACHABLE_CODE = YES;
-				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
 				CODE_SIGN_IDENTITY = "-";
+				CODE_SIGN_STYLE = Automatic;
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				ENABLE_NS_ASSERTIONS = NO;
-				ENABLE_STRICT_OBJC_MSGSEND = YES;
-				GCC_C_LANGUAGE_STANDARD = gnu99;
-				GCC_NO_COMMON_BLOCKS = YES;
-				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-				GCC_WARN_UNDECLARED_SELECTOR = YES;
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-				GCC_WARN_UNUSED_FUNCTION = YES;
-				HEADER_SEARCH_PATHS = (
-					/usr/local/include,
-					/opt/local/include,
-				);
-				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				INFOPLIST_FILE = "rotate-test/Info.plist";
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				MTL_ENABLE_DEBUG_INFO = NO;
+				MTL_FAST_MATH = YES;
+				PRODUCT_BUNDLE_IDENTIFIER = "leumasjaffe.rotate-test";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SDKROOT = macosx;
 			};
 			name = Release;
 		};
@@ -352,20 +383,11 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
-		0E9E98B31BBC8A03004FFE25 /* Build configuration list for PBXLegacyTarget "rotate" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				0E9E98B41BBC8A03004FFE25 /* Debug */,
-				0E9E98B51BBC8A03004FFE25 /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Release;
-		};
-		CD0C76CF1E2AB8DF0096E269 /* Build configuration list for PBXNativeTarget "rotate_tc" */ = {
+		CDB3AEED230AE35D0015D09E /* Build configuration list for PBXNativeTarget "rotate-test" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				CD0C76CD1E2AB8DF0096E269 /* Debug */,
-				CD0C76CE1E2AB8DF0096E269 /* Release */,
+				CDB3AEEE230AE35D0015D09E /* Debug */,
+				CDB3AEEF230AE35D0015D09E /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;

+ 57 - 0
rotate.xcodeproj/xcshareddata/xcschemes/rotate-test.xcscheme

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1030"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      codeCoverageEnabled = "YES"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "CDB3AEE7230AE35D0015D09E"
+               BuildableName = "rotate-test.xctest"
+               BlueprintName = "rotate-test"
+               ReferencedContainer = "container:rotate.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 122 - 0
test/rotate_test.cpp

@@ -0,0 +1,122 @@
+//
+//  rotate_test.cpp
+//  datamodel
+//
+//  Created by Sam Jaffe on 9/30/15.
+//
+//
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "rotate/rotate.hpp"
+
+struct Point {
+  float x = 0.f, y = 0.f;
+  
+  Point() = default;
+  Point(float _x, float _y) : x(_x), y(_y) {}
+  
+  bool operator==(const Point& other) const {
+    return !memcmp(this, &other, sizeof(*this));
+  }
+};
+
+struct Dimension {
+  float width = 0.f, height = 0.f;
+  
+  Dimension() = default;
+  Dimension(float w, float h) : width(w), height(h) {}
+  
+  bool operator==(const Dimension& other) const {
+    return !memcmp(this, &other, sizeof(*this));
+  }
+};
+
+struct Material {
+  int id = -1;
+  
+  Material() = default;
+  Material(int i) : id(i) {}
+  
+  bool operator==(const Material& other) const {
+    return !memcmp(this, &other, sizeof(*this));
+  }
+};
+
+struct RenderInfo {
+  Point center;
+  Material material;
+  Dimension texture_size, object_size;
+  Point bottom_left, bottom_right, top_right, top_left;
+  float rotation = 0.0f; // TODO
+  
+  RenderInfo(Point c, Dimension sz, Material mat = {0}, Dimension tx_sz = {1.f, 1.f})
+  : center(c)
+  , material(mat)
+  , texture_size(tx_sz)
+  , object_size(sz)
+  , bottom_left ({c.x - sz.width / 2.f, c.y - sz.height / 2.f})
+  , bottom_right({c.x - sz.width / 2.f, c.y + sz.height / 2.f})
+  , top_right   ({c.x + sz.width / 2.f, c.y + sz.height / 2.f})
+  , top_left    ({c.x + sz.width / 2.f, c.y - sz.height / 2.f})
+  {
+    
+  }
+  
+  RenderInfo() = default;
+  
+  bool operator==(const RenderInfo& other) const {
+    return !memcmp(this, &other, sizeof(*this));
+  }
+};
+
+DEFINE_ROTATE(RenderInfo, (material)(texture_size)(bottom_left)(bottom_right)(top_right)(top_left));
+
+DEFINE_ROTATE_NAME(simple_rotate, RenderInfo, (material)(texture_size)(center)(object_size));
+
+DEFINE_PROXY_NAME(RenderInfo_position_proxy, RenderInfo, (center)(object_size));
+DEFINE_PROXY_CONVERSION(RenderInfo, (material)(texture_size)(center)(object_size), (center)(object_size) );
+
+TEST(RotateTest, CanCreateNormalProxyForData) {
+  RenderInfo_rotate rdata;
+  RenderInfo info{{5, 6}, {1, 1}};
+  rdata.push_back(info);
+  RenderInfo_proxy proxy = rdata.get(0);
+  EXPECT_THAT(info.texture_size, proxy.texture_size);
+  EXPECT_THAT(info.bottom_left, proxy.bottom_left);
+  EXPECT_THAT(info.bottom_right, proxy.bottom_right);
+  EXPECT_THAT(info.top_left, proxy.top_left);
+  EXPECT_THAT(info.top_right, proxy.top_right);
+}
+
+TEST(RotateTest, CanCreatePartialProxy) {
+  simple_rotate rdata;
+  RenderInfo info{{5, 6}, {1, 1}};
+  rdata.push_back(info);
+  simple_rotate_proxy proxy = rdata.get(0);
+  EXPECT_THAT(info.texture_size, proxy.texture_size);
+  EXPECT_THAT(info.center, proxy.center);
+  EXPECT_THAT(info.object_size, proxy.object_size);
+}
+
+TEST(RotateTest, RotatedDataModelExistsAsStructOfVectors) {
+  simple_rotate rdata;
+  RenderInfo infos[3] = {{{1,2},{1,1}},{{0,3},{1,1}},{{4,3.2f},{1,1}}};
+  rdata.push_back(infos[0]);
+  rdata.push_back(infos[1]);
+  rdata.push_back(infos[2]);
+  EXPECT_THAT(rdata.get(access_t(RenderInfo, center){}),
+              (std::vector<Point>{{1,2},{0,3},{4,3.2f}}));
+}
+
+TEST(RotateTest, CanCreateMultipleProxiesForSameObject)  {
+  simple_rotate rdata;
+  RenderInfo info{{5, 6}, {1, 1}};
+  rdata.push_back(info);
+  RenderInfo_position_proxy proxy =
+      rdata.getp<rotate_members(RenderInfo, (center)(object_size))>(0);
+  EXPECT_THAT( sizeof(proxy), sizeof(Point&)+sizeof(Dimension&) );
+  EXPECT_THAT(info.center, proxy.center);
+  EXPECT_THAT(info.object_size, proxy.object_size);
+}