summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2015-09-19 16:21:31 +0200
committerCsaba Hruska <csaba.hruska@gmail.com>2015-09-19 16:21:31 +0200
commita4cc2d82b196a1e087c4b822ad47b307c9f3b08d (patch)
treef4192630feb05bb18432d268ef22cc9d2e46624c
parent9ae5fb17b9dd2f7bea8b9297402ed110b41cf2ed (diff)
ddl: add test programs
-rw-r--r--test/idCpp.cpp31
-rw-r--r--test/idHs.hs8
2 files changed, 39 insertions, 0 deletions
diff --git a/test/idCpp.cpp b/test/idCpp.cpp
new file mode 100644
index 0000000..24894f4
--- /dev/null
+++ b/test/idCpp.cpp
@@ -0,0 +1,31 @@
1#include <string>
2#include <iostream>
3#include <istream>
4#include <ostream>
5#include <iterator>
6
7#include "Mesh.hpp"
8#include "IR.hpp"
9#include "TypeInfo.hpp"
10
11int main() {
12 // don't skip the whitespace while reading
13 std::cin >> std::noskipws;
14
15 // use stream iterators to copy the stream to a string
16 std::istream_iterator<char> it(std::cin);
17 std::istream_iterator<char> end;
18 std::string results(it, end);
19
20 try {
21 json jobjIn = json::parse(results);
22 std::shared_ptr<Pipeline> b = fromJSON(W<std::shared_ptr<Pipeline>>(),jobjIn);
23 std::shared_ptr<data::Pipeline> tv = std::static_pointer_cast<data::Pipeline>(b);
24 json jobjOut = toJSON(b);
25 std::cout << jobjOut;
26 } catch (std::string e) {
27 std::cout << "exception: " << e << "\n";
28 } catch (...) { std::cout << "default exception\n"; }
29
30 return 0;
31}
diff --git a/test/idHs.hs b/test/idHs.hs
new file mode 100644
index 0000000..7cd9917
--- /dev/null
+++ b/test/idHs.hs
@@ -0,0 +1,8 @@
1{-# LANGUAGE ScopedTypeVariables #-}
2import qualified Data.ByteString.Lazy as B
3import Data.Aeson
4import IR
5
6main = do
7 Just (p :: Pipeline) <- decode <$> B.getContents
8 B.putStr $ encode p