Debian Codegraph @

build/qualification_test/src/suite_gui/suite.rs

raw
1 //! This module implements a TestSuite for testing the graphical user interface
2 //! of crystal-facet-uml.
3
4 use crate::test_tool::test_case::TestCase;
5 use crate::test_tool::test_suite::TestSuite;
6
7 /// A test suite consists of a name, a test fixture and an array of test cases
8 ///
9 /// # Lifetimes
10 ///
11 /// * `'all_testing` refers to the lifetime of `TestSuite` and `TestCase`
12 /// objects: They exist during the whole test run.
13 ///
14 pub struct SuiteGui<'all_testing> {
15 name: &'all_testing str,
16 cases: [TestCase<'all_testing, ()>; 0],
17 }
18
19 /// A test suite comes with a constructor
20 impl<'all_testing, 'a, 'b> SuiteGui<'all_testing>
21 where
22 'a: 'all_testing,
23 'b: 'all_testing,
24 {
25 /// Defines all test cases in this test suite
26 ///
27 /// # Arguments
28 ///
29 /// * `exe_to_test` - A path to the executable to be tested
30 /// * `temp_dir` - A path to a directory that exists and can be used for testing
31 ///
32 pub fn new(_exe_to_test: &'a str, _temp_dir: &'b str) -> SuiteGui<'all_testing> {
33 SuiteGui {
34 name: "SuiteGui",
35 cases: [],
36 }
37 }
38 }
39
40 /// The `SuiteGui` test suite implements the `TestSuite` trait
41 impl<'all_testing> TestSuite<'all_testing, ()> for SuiteGui<'all_testing> {
42 /// The name of the test suite
43 fn name(self: &'all_testing Self) -> &'all_testing str {
44 self.name
45 }
46
47 /// Creates a test directory
48 ///
49 /// Panics if the test environment reports errors.
50 fn setup(self: &'all_testing Self) -> () {
51 ()
52 }
53
54 /// Removes the test directory
55 ///
56 /// Panics if the test environment reports errors.
57 fn teardown(self: &'all_testing Self, _environment: ()) -> () {}
58
59 fn testcases(self: &'all_testing Self) -> &'all_testing [TestCase<'all_testing, ()>] {
60 &self.cases
61 }
62 }
63
64 /*
65 Copyright 2022-2026 Andreas Warnke
66
67 Licensed under the Apache License, Version 2.0 (the "License");
68 you may not use this file except in compliance with the License.
69 You may obtain a copy of the License at
70
71 http://www.apache.org/licenses/LICENSE-2.0
72
73 Unless required by applicable law or agreed to in writing, software
74 distributed under the License is distributed on an "AS IS" BASIS,
75 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76 See the License for the specific language governing permissions and
77 limitations under the License.
78 */