Add test for Unpack in Reactor

Test: New test passes
Bug: b/67106219
Change-Id: Ib21f73d312d39cf2b3aa15a11d2a207885a58978
Reviewed-on: https://swiftshader-review.googlesource.com/12828
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
diff --git a/src/Reactor/Main.cpp b/src/Reactor/Main.cpp
index 8430d3d..fd365c4 100644
--- a/src/Reactor/Main.cpp
+++ b/src/Reactor/Main.cpp
@@ -773,6 +773,53 @@
 	delete routine;
 }
 
+TEST(SubzeroReactorTest, Unpack)
+{
+	Routine *routine = nullptr;
+
+	{
+		Function<Int(Pointer<Byte>,Pointer<Byte>)> function;
+		{
+			Pointer<Byte> in = function.Arg<0>();
+			Pointer<Byte> out = function.Arg<1>();
+
+			Byte4 test_byte_a = *Pointer<Byte4>(in + 4 * 0);
+			Byte4 test_byte_b = *Pointer<Byte4>(in + 4 * 1);
+
+			*Pointer<Short4>(out + 8 * 0) =
+				Unpack(test_byte_a, test_byte_b);
+
+			*Pointer<Short4>(out + 8 * 1) = Unpack(test_byte_a);
+
+			Return(0);
+		}
+
+		routine = function(L"one");
+
+		if(routine)
+		{
+			int in[1][2];
+			int out[2][2];
+
+			memset(&out, 0, sizeof(out));
+
+			in[0][0] = 0xABCDEF12;
+			in[0][1] = 0x34567890;
+
+			int(*callable)(void*,void*) = (int(*)(void*,void*))routine->getEntry();
+			callable(&in, &out);
+
+			EXPECT_EQ(out[0][0], 0x78EF9012);
+			EXPECT_EQ(out[0][1], 0x34AB56CD);
+
+			EXPECT_EQ(out[1][0], 0xEFEF1212);
+			EXPECT_EQ(out[1][1], 0xABABCDCD);
+		}
+	}
+
+	delete routine;
+}
+
 int main(int argc, char **argv)
 {
 	::testing::InitGoogleTest(&argc, argv);