From a680b72a0aae6ae4928f02f4ce77d6b4ec14f5e3 Mon Sep 17 00:00:00 2001
From: whh8b <whh8b@git.zephyr-software.com>
Date: Mon, 14 Dec 2015 05:19:22 +0000
Subject: [PATCH] Add initial Dollop testing framework.

---
 .gitattributes      |  1 +
 test/SConscript     | 10 +++++++++-
 test/ZiprDollop.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 test/ZiprDollop.cpp

diff --git a/.gitattributes b/.gitattributes
index 4f969cb..74a34ac 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -32,6 +32,7 @@ src/zipr_stats.cpp -text
 test/MemorySpace.cpp -text
 test/SConscript -text
 test/SConstruct -text
+test/ZiprDollop.cpp -text
 test/ZiprOptions.cpp -text
 test/dylib/Makefile -text
 test/dylib/dylib.c -text
diff --git a/test/SConscript b/test/SConscript
index c65b3f2..df5eaf4 100644
--- a/test/SConscript
+++ b/test/SConscript
@@ -19,6 +19,13 @@ OptionFiles=  '''
 	../src/zipr_options.cpp
 	'''
 
+DollopFiles= '''
+	ZiprDollop.cpp
+	../src/zipr_dollop_man.cpp
+	../src/dollop.cpp
+	../src/utils.cpp
+	'''
+
 # ELFIO needs to be first so we get the zipr version instead of the sectrans version.  the zipr version is modified to include get_offset.
 cpppath=''' 
 	.
@@ -60,5 +67,6 @@ myenv=myenv.Clone(CPPPATH=Split(cpppath), LIBS=Split(libs), LIBPATH=Split(libpat
 
 MemorySpace=myenv.Program("MemorySpace.exe", Split(MemorySpaceFiles))
 Options=myenv.Program("Options.exe", Split(OptionFiles))
-Default([MemorySpace, Options])
+Dollop=myenv.Program("Dollop.exe", Split(DollopFiles))
+Default([MemorySpace, Options, Dollop])
 
diff --git a/test/ZiprDollop.cpp b/test/ZiprDollop.cpp
new file mode 100644
index 0000000..85692e9
--- /dev/null
+++ b/test/ZiprDollop.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 - Zephyr Software LLC
+ *
+ * This file may be used and modified for non-commercial purposes as long as
+ * all copyright, permission, and nonwarranty notices are preserved.
+ * Redistribution is prohibited without prior written consent from Zephyr
+ * Software.
+ *
+ * Please contact the authors for restrictions applying to commercial use.
+ *
+ * THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Author: Zephyr Software
+ * e-mail: jwd@zephyr-software.com
+ * URL   : http://www.zephyr-software.com/
+ *
+ */
+
+#include <zipr_all.h>
+#include <zipr_sdk.h>
+
+using namespace zipr;
+using namespace std;
+
+#define INVOKE(a) \
+bool __ ## a ## _result = false; \
+__ ## a ## _result = a(); \
+printf(#a ":"); \
+if (__ ## a ## _result) \
+{ \
+printf(" pass\n"); \
+} \
+else \
+{ \
+printf(" fail\n"); \
+}
+
+int main(int argc, char *argv[])
+{
+	ZiprDollopManager_t dollop_man;
+	libIRDB::Instruction_t *insn = new libIRDB::Instruction_t();
+	dollop_man.AddDollop(ZiprDollopManager_t::CreateDollop(insn));
+	return 0;
+}
-- 
GitLab