1use entity::Entity;
2use language_type::LanguageType;
3use std::marker::PhantomData;
4
5static STUB_ID_SET_UP_CONTEXT: &str = "#SET_UP";
8static STUB_ID_TEAR_DOWN_CONTEXT: &str = "#TEAR_DOWN";
9static STUB_ID_CONSTRUCTOR_CONTEXT: &str = "#CONSTRUCTOR";
10static STUB_ID_DESTRUCTOR_CONTEXT: &str = "#DESTRUCTOR";
11static STUB_ID_CLASS_CONTEXT: &str = "#CLASS_CONTEXT";
12
13type StubContext = String;
14
15pub trait StubContextConversion {
16 fn convert(stub_context_type: &StubContextType) -> Option<&StubContext>;
17}
18
19impl StubContextConversion for StubContext {
20 fn convert(stub_contex_type: &StubContextType) -> Option<&StubContext> {
21 match stub_contex_type {
22 StubContextType::SetUpContext(stub_context)
23 | StubContextType::TearDownContext(stub_context)
24 | StubContextType::ConstructorContext(stub_context)
25 | StubContextType::DestructorContext(stub_context)
26 | StubContextType::ClassContext(stub_context) => Some(stub_context),
27 }
28 }
29}
30
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub enum StubContextType {
33 SetUpContext(StubContext),
34 TearDownContext(StubContext),
35 ConstructorContext(StubContext),
36 DestructorContext(StubContext),
37 ClassContext(StubContext),
38}
39
40#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
43pub struct TestFunction {
44 pub name: String,
45}
46
47#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
53pub struct TestClass {
54 pub stub_context: Vec<StubContextType>,
55 pub test_functions: Vec<TestFunction>,
56}
57
58impl TestClass {
59 pub fn new() -> Self {
72 Self {
73 stub_context: Vec::new(),
74 test_functions: Vec::new(),
75 }
76 }
77
78 pub fn add_stub_context(&mut self, context: StubContextType) -> Option<&StubContext> {
96 self.stub_context.push(context);
97 if let Some(stub_context) = self.stub_context.last() {
98 return StubContext::convert(stub_context);
99 }
100
101 None
102 }
103}
104
105#[derive(Default, Debug)]
108pub struct TestFile<T> {
109 pub pf_type: PhantomData<T>,
110 pub entities: Vec<Entity>,
111}
112
113impl<T> TestFile<T> where T: LanguageType {}
115
116#[derive(Default, Debug)]
119pub struct Synthesis {}