use entity::Entity;
use language_type::LanguageType;
use std::marker::PhantomData;
static STUB_ID_SET_UP_CONTEXT: &str = "#SET_UP";
static STUB_ID_TEAR_DOWN_CONTEXT: &str = "#TEAR_DOWN";
static STUB_ID_CONSTRUCTOR_CONTEXT: &str = "#CONSTRUCTOR";
static STUB_ID_DESTRUCTOR_CONTEXT: &str = "#DESTRUCTOR";
static STUB_ID_CLASS_CONTEXT: &str = "#CLASS_CONTEXT";
type StubContext = String;
pub trait StubContextConversion {
fn convert(stub_context_type: &StubContextType) -> Option<&StubContext>;
}
impl StubContextConversion for StubContext {
fn convert(stub_contex_type: &StubContextType) -> Option<&StubContext> {
match stub_contex_type {
StubContextType::SetUpContext(stub_context)
| StubContextType::TearDownContext(stub_context)
| StubContextType::ConstructorContext(stub_context)
| StubContextType::DestructorContext(stub_context)
| StubContextType::ClassContext(stub_context) => Some(stub_context),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum StubContextType {
SetUpContext(StubContext),
TearDownContext(StubContext),
ConstructorContext(StubContext),
DestructorContext(StubContext),
ClassContext(StubContext),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TestFunction {
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TestClass {
pub stub_context: Vec<StubContextType>,
pub test_functions: Vec<TestFunction>,
}
impl TestClass {
pub fn new() -> Self {
Self {
stub_context: Vec::new(),
test_functions: Vec::new(),
}
}
pub fn add_stub_context(&mut self, context: StubContextType) -> Option<&StubContext> {
self.stub_context.push(context);
if let Some(stub_context) = self.stub_context.last() {
return StubContext::convert(stub_context);
}
None
}
}
#[derive(Default, Debug)]
pub struct TestFile<T> {
pub pf_type: PhantomData<T>,
pub entities: Vec<Entity>,
}
impl<T> TestFile<T> where T: LanguageType {}
#[derive(Default, Debug)]
pub struct Synthesis {}