summaryrefslogtreecommitdiff
path: root/support/ltx2mathml/src/test.cpp
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-23 03:02:00 +0000
committerNorbert Preining <norbert@preining.info>2020-10-23 03:02:00 +0000
commitc6303e38664a7a78e8f21a4390b69e5aa9cf5c93 (patch)
treeb95dddc8dde54ba0f7189d0edaf24877d61bb44b /support/ltx2mathml/src/test.cpp
parent7448609d1256af02966b8f84fe8464234276ce7a (diff)
CTAN sync 202010230301
Diffstat (limited to 'support/ltx2mathml/src/test.cpp')
-rw-r--r--support/ltx2mathml/src/test.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/support/ltx2mathml/src/test.cpp b/support/ltx2mathml/src/test.cpp
new file mode 100644
index 0000000000..99b68a5d58
--- /dev/null
+++ b/support/ltx2mathml/src/test.cpp
@@ -0,0 +1,41 @@
+// testtex.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+#include "ltx2mathml.h"
+
+
+int main()
+{
+ int index;
+ char input[256];
+
+ while (true)
+ {
+ printf("> ");
+
+ if( !fgets(input, 255, stdin) || ('\n' == input[0]))
+ break;
+ else
+ {
+ if (convertFormula(input, -1, &index))// -1 indicates 'input' is null terminated
+ {
+ string result;
+
+ if (getMathMLOutput(result, true))
+ {
+ std::cout << result << std::endl;
+ }
+ else
+ {
+ std::cout << "Input produced no output\n";
+ }
+ }
+ else
+ {
+ std::cout << "[Index: " << index << "] " << getLastError() << std::endl;
+ }
+ }
+ }
+ return 0;
+}