mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-21 21:24:41 +01:00
test: fix running tests
This commit is contained in:
parent
8f3c426359
commit
5bf277cf14
|
@ -14,23 +14,33 @@ pub fn from_ron(raw: &str) -> Rpl {
|
|||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||
pub struct Rpl(pub Vec<Instruction>);
|
||||
|
||||
#[test]
|
||||
fn test_simple_deserialize() {
|
||||
const TEST_DATA: &str =
|
||||
"([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])";
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::instructions::{
|
||||
read::{SourceFormat, SourceType},
|
||||
write::{TargetFormat, TargetType},
|
||||
MathInstruction,
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
from_ron(TEST_DATA),
|
||||
Rpl(vec![
|
||||
Instruction::Read(instructions::read::Read {
|
||||
source: SourceType::File("~/example/file.png".into()),
|
||||
format: SourceFormat::Png
|
||||
}),
|
||||
Instruction::Math(MathInstruction::Add),
|
||||
Instruction::Write(instructions::write::Write {
|
||||
target: TargetType::File("~/example/out.jpg".into()),
|
||||
format: TargetFormat::Jpeg
|
||||
})
|
||||
])
|
||||
);
|
||||
#[test]
|
||||
fn test_simple_deserialize() {
|
||||
const TEST_DATA: &str =
|
||||
"([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])";
|
||||
|
||||
assert_eq!(
|
||||
from_ron(TEST_DATA),
|
||||
Rpl(vec![
|
||||
Instruction::Read(instructions::read::Read {
|
||||
source: SourceType::File("~/example/file.png".into()),
|
||||
format: SourceFormat::Png
|
||||
}),
|
||||
Instruction::Math(MathInstruction::Add),
|
||||
Instruction::Write(instructions::write::Write {
|
||||
target: TargetType::File("~/example/out.jpg".into()),
|
||||
format: TargetFormat::Jpeg
|
||||
})
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue