Add basic unit tests
diff --git a/tests/FishhookTests.m b/tests/FishhookTests.m
new file mode 100644
index 0000000..0a54bc9
--- /dev/null
+++ b/tests/FishhookTests.m
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (c) 2016-present, Facebook, Inc.
+ *  All rights reserved.
+ *
+ *  This source code is licensed under the BSD-style license found in the
+ *  LICENSE file in the root directory of this source tree. An additional grant
+ *  of patent rights can be found in the PATENTS file in the same directory.
+ *
+ */
+
+#import <XCTest/XCTest.h>
+
+#include "fishhook.h"
+
+static __typeof__(&atoi) orig_atoi;
+
+static int fast_atoi(const char *str)
+{
+  return str[0] - '0';
+}
+
+@interface FishhookTests : XCTestCase
+@end
+
+@implementation FishhookTests
+
+- (void)testHookAtoi
+{
+  rebind_symbols((struct rebinding[1]){{"atoi", fast_atoi, (void *)&orig_atoi}}, 1);
+  XCTAssertEqual(atoi("1"), 1);
+  XCTAssertNotEqual(atoi("12"), 12);
+}
+
+@end
diff --git a/tests/fishhook-tests.xcodeproj/project.pbxproj b/tests/fishhook-tests.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..4c28cfe
--- /dev/null
+++ b/tests/fishhook-tests.xcodeproj/project.pbxproj
@@ -0,0 +1,261 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 47;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		7ABE8A081D81151700D63114 /* FishhookTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ABE8A071D81151700D63114 /* FishhookTests.m */; };
+		7ABE8A101D81156800D63114 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 7ABE8A0F1D81156800D63114 /* fishhook.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		7ABE8A041D81151700D63114 /* fishhook-tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "fishhook-tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+		7ABE8A071D81151700D63114 /* FishhookTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FishhookTests.m; sourceTree = SOURCE_ROOT; };
+		7ABE8A0E1D81156800D63114 /* fishhook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fishhook.h; path = ../fishhook.h; sourceTree = "<group>"; };
+		7ABE8A0F1D81156800D63114 /* fishhook.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fishhook.c; path = ../fishhook.c; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		7ABE8A011D81151700D63114 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		7ABE89F91D8114F600D63114 = {
+			isa = PBXGroup;
+			children = (
+				7ABE8A0D1D81155C00D63114 /* fishhook */,
+				7ABE8A061D81151700D63114 /* fishhook-tests */,
+				7ABE8A051D81151700D63114 /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		7ABE8A051D81151700D63114 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				7ABE8A041D81151700D63114 /* fishhook-tests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		7ABE8A061D81151700D63114 /* fishhook-tests */ = {
+			isa = PBXGroup;
+			children = (
+				7ABE8A071D81151700D63114 /* FishhookTests.m */,
+			);
+			path = "fishhook-tests";
+			sourceTree = "<group>";
+		};
+		7ABE8A0D1D81155C00D63114 /* fishhook */ = {
+			isa = PBXGroup;
+			children = (
+				7ABE8A0E1D81156800D63114 /* fishhook.h */,
+				7ABE8A0F1D81156800D63114 /* fishhook.c */,
+			);
+			name = fishhook;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		7ABE8A031D81151700D63114 /* fishhook-tests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 7ABE8A0A1D81151700D63114 /* Build configuration list for PBXNativeTarget "fishhook-tests" */;
+			buildPhases = (
+				7ABE8A001D81151700D63114 /* Sources */,
+				7ABE8A011D81151700D63114 /* Frameworks */,
+				7ABE8A021D81151700D63114 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "fishhook-tests";
+			productName = "fishhook-tests";
+			productReference = 7ABE8A041D81151700D63114 /* fishhook-tests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		7ABE89FA1D8114F600D63114 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0730;
+				TargetAttributes = {
+					7ABE8A031D81151700D63114 = {
+						CreatedOnToolsVersion = 7.3.1;
+					};
+				};
+			};
+			buildConfigurationList = 7ABE89FD1D8114F600D63114 /* Build configuration list for PBXProject "fishhook-tests" */;
+			compatibilityVersion = "Xcode 6.3";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 7ABE89F91D8114F600D63114;
+			productRefGroup = 7ABE8A051D81151700D63114 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				7ABE8A031D81151700D63114 /* fishhook-tests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		7ABE8A021D81151700D63114 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		7ABE8A001D81151700D63114 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				7ABE8A101D81156800D63114 /* fishhook.c in Sources */,
+				7ABE8A081D81151700D63114 /* FishhookTests.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		7ABE89FE1D8114F600D63114 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Debug;
+		};
+		7ABE89FF1D8114F600D63114 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		7ABE8A0B1D81151700D63114 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				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;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+			};
+			name = Debug;
+		};
+		7ABE8A0C1D81151700D63114 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = 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_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				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_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				MTL_ENABLE_DEBUG_INFO = NO;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		7ABE89FD1D8114F600D63114 /* Build configuration list for PBXProject "fishhook-tests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7ABE89FE1D8114F600D63114 /* Debug */,
+				7ABE89FF1D8114F600D63114 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		7ABE8A0A1D81151700D63114 /* Build configuration list for PBXNativeTarget "fishhook-tests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7ABE8A0B1D81151700D63114 /* Debug */,
+				7ABE8A0C1D81151700D63114 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 7ABE89FA1D8114F600D63114 /* Project object */;
+}
diff --git a/tests/fishhook-tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/fishhook-tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..69be54c
--- /dev/null
+++ b/tests/fishhook-tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:fishhook-tests.xcodeproj">
+   </FileRef>
+</Workspace>