This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite how test cases are stored
Instead of creating separate models for each test case data type, we will store them all in a string and let the data decide how to work with it. However, this method will result in us losing the ability to do strict output comparisons (we have implemented only string based output correctness checking). I do not think I am willing to give up such a big feature for a little ease of db schema. However I will keep this in commit history so that I can reference it later down the line.
- Loading branch information
Showing
25 changed files
with
92 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,15 @@ | ||
use async_graphql::{Enum, InputObject, SimpleObject}; | ||
use main_db::ToEdgeqlString; | ||
use serde::{Deserialize, Serialize}; | ||
use strum::EnumIter; | ||
|
||
#[derive(Enum, Copy, Clone, Eq, PartialEq, Debug, EnumIter, Deserialize, Serialize)] | ||
pub enum TestCaseUnit { | ||
#[serde(rename = "NumberUnit")] | ||
Number, | ||
#[serde(rename = "StringUnit")] | ||
String, | ||
#[serde(rename = "NumberCollectionUnit")] | ||
NumberCollection, | ||
#[serde(rename = "StringCollectionUnit")] | ||
StringCollection, | ||
} | ||
|
||
impl ToEdgeqlString for TestCaseUnit { | ||
fn get_module_name() -> String { | ||
"learning".to_string() | ||
} | ||
} | ||
|
||
#[derive(Debug, SimpleObject, InputObject)] | ||
pub struct InputCaseUnit { | ||
pub data_type: TestCaseUnit, | ||
pub data: String, | ||
/// The name of the variable to store it as | ||
pub name: String, | ||
} | ||
use async_graphql::{InputObject, SimpleObject}; | ||
|
||
#[derive(Debug, SimpleObject, InputObject)] | ||
pub struct OutputCaseUnit { | ||
/// The type of data to store this line as | ||
pub data_type: TestCaseUnit, | ||
pub struct TestCaseDataInput { | ||
/// The data to store | ||
pub data: String, | ||
} | ||
|
||
#[derive(Debug, SimpleObject, InputObject)] | ||
pub struct TestCase { | ||
pub struct TestCaseInput { | ||
/// The inputs related to this test case | ||
pub inputs: Vec<InputCaseUnit>, | ||
pub inputs: Vec<TestCaseDataInput>, | ||
/// The outputs related to this test case | ||
pub outputs: Vec<OutputCaseUnit>, | ||
pub outputs: Vec<TestCaseDataInput>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.