Browse code

Add implementation

Robert Cranston authored on 15/03/2021 19:32:43
Showing 1 changed files
... ...
@@ -0,0 +1,35 @@
1
+#include <gltest.hpp>
2
+
3
+#include <stdexcept>
4
+#include <string>
5
+
6
+#include <glbackend_default.hpp>
7
+
8
+
9
+std::vector<GLTest_> & gltests_()
10
+{
11
+    auto static tests = std::vector<GLTest_>{};
12
+    return tests;
13
+}
14
+
15
+
16
+int main()
17
+{
18
+    for (auto const & test : gltests_())
19
+    {
20
+        auto error = std::string{};
21
+        auto backend = GLBackendDefault(
22
+            test.title,
23
+            {test.width, test.height},
24
+            {test.version_major, test.version_minor}
25
+        );
26
+        backend.debug_callback([&](std::string const & message)
27
+        {
28
+            if (error.empty())
29
+                error = message;
30
+        });
31
+        test.func(backend);
32
+        if (!error.empty())
33
+            throw std::runtime_error{error};
34
+    }
35
+}
Browse code

Add project

Robert Cranston authored on 15/03/2021 19:32:33
Showing 1 changed files
1 1
new file mode 100644