int main(void) { int result; error err = calc(10, 20, result); if (err != error::success) { printf("%s:%d: %s\n", getErrorFile().c_str(), getErrorLine(), getErrorMessage(err)); } else { printf("No error\n"); } return 0; }
static void checkShader (int i) { int err; char msg[256]; glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &err); if (err >= 0) { getErrorLine(ShaderSrc[i], err, msg, sizeof(msg)); printf("Error in shader #%d: %s\n", i, glGetString(GL_PROGRAM_ERROR_STRING_ARB)); printf("Source line: %s\n", msg); } }
#include <Python.h> #include <catch/catch.hpp> #include "graph/graph.h" #include "graph/script_node.h" #include "graph/datum.h" #include "graph/proxy.h" TEST_CASE("Script evaluation") { auto g = new Graph(); auto n = new ScriptNode("n", g); n->setScript("print('hi there!')"); CAPTURE(n->getError()); REQUIRE(n->getErrorLine() == -1); delete g; } TEST_CASE("Invalid script") { auto g = new Graph(); auto n = new ScriptNode("n", g); n->setScript("wargarble"); CAPTURE(n->getError()); REQUIRE(n->getErrorLine() == 1); delete g; } TEST_CASE("Script with import") {