diff test/test.cc @ 36:677c03c382b8

Backed out changeset e26874655738
author Paper <paper@tflc.us>
date Fri, 25 Apr 2025 17:40:55 -0400
parents 41dd962abdd1
children 4b5a557aa64f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/test.cc	Fri Apr 25 17:40:55 2025 -0400
@@ -0,0 +1,27 @@
+#define VEC_IMPLEMENTATION
+#include "vec/vec.h"
+
+#include <iostream>
+
+/* this test makes sure that vec can be included under C++ */
+int main(void)
+{
+	int ret = 0;
+
+	VUINT32x8_ALIGNED_ARRAY(varrin);
+	VUINT32x8_ALIGNED_ARRAY(varrout);
+
+	for (int i = 0; i < 8; i++)
+		varrin[i] = i;
+
+	vuint32x8 vec = vuint32x8_load_aligned(varrin);
+	vec = vuint32x8_add(vec, vec);
+
+	vuint32x8_store_aligned(vec, varrout);
+
+	for (int i = 0; i < 8; i++)
+		if (varrout[i] != (uint32_t)(varrin[i] + varrin[i]))
+			ret |= 1;
+
+	return ret;
+}
\ No newline at end of file