From c2436868f57d5b3242712a2e90600884fcd45512 Mon Sep 17 00:00:00 2001 From: Alexey Fedoseev Date: Mon, 22 Apr 2024 21:51:59 +0300 Subject: [PATCH] add new single state test --- tests/07-output.txt | 1 + tests/07-single-state.cpp | 41 +++++++++++++++++++++++ tests/07-single-state.test-output.graphml | 41 +++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 tests/07-output.txt create mode 100644 tests/07-single-state.cpp create mode 100644 tests/07-single-state.test-output.graphml diff --git a/tests/07-output.txt b/tests/07-output.txt new file mode 100644 index 0000000..6f3fbff --- /dev/null +++ b/tests/07-output.txt @@ -0,0 +1 @@ +Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Simple State: {id: 'n0', name: 'First state'}}}} diff --git a/tests/07-single-state.cpp b/tests/07-single-state.cpp new file mode 100644 index 0000000..7ef9ac7 --- /dev/null +++ b/tests/07-single-state.cpp @@ -0,0 +1,41 @@ +/* ----------------------------------------------------------------------------- + * The Cyberiada GraphML C++ library implemention + * + * The test + * + * Copyright (C) 2024 Alexey Fedoseev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see https://www.gnu.org/licenses/ + * ----------------------------------------------------------------------------- */ + +#include +#include "cyberiadamlpp.h" +#include "testutils.h" + +using namespace Cyberiada; +using namespace std; + +int main(int argc, char** argv) +{ + Document d; + StateMachine* sm = d.new_state_machine("SM"); + d.new_state(sm, "First state"); + try { + cout << d << endl; + d.save(string(argv[0]) + ".graphml", formatCyberiada10); + } catch (const Cyberiada::Exception&) { + return 1; + } + return 0; +} diff --git a/tests/07-single-state.test-output.graphml b/tests/07-single-state.test-output.graphml new file mode 100644 index 0000000..5bab763 --- /dev/null +++ b/tests/07-single-state.test-output.graphml @@ -0,0 +1,41 @@ + + + Cyberiada-GraphML-1.0 + + + + + + + + + + + + + + + + + + + + + + SM + + formal + CGML_META + standardVersion/ 1.0 + +transitionOrder/ transitionFirst + +eventPropagation/ block + + + + + First state + + +