-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Florian Guggi
committed
Dec 26, 2023
1 parent
e44f4f0
commit 0c4447a
Showing
8 changed files
with
144 additions
and
114 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::simulation::*; | ||
use std::{io::Cursor, time::Duration}; | ||
|
||
#[test] | ||
fn full_run() { | ||
let (mut com, _socat) = SimulationComHandle::with_socat_proc("full_run"); | ||
let _sched = start_scheduler("full_run").unwrap(); | ||
|
||
// store and execute program | ||
simulate_test_store_archive(&mut com, 1).unwrap(); | ||
simulate_execute_program(&mut com, 1, 3, 3).unwrap(); | ||
std::thread::sleep(Duration::from_secs(1)); | ||
|
||
// read program finished and result ready | ||
assert_eq!(simulate_get_status(&mut com).unwrap(), [1, 1, 0, 3, 0, 0, 0, 0]); | ||
assert_eq!(simulate_get_status(&mut com).unwrap(), [2, 1, 0, 3, 0, 0, 0]); | ||
|
||
// Check result | ||
let result = simulate_return_result(&mut com, 1, 3).unwrap(); | ||
let mut result_archive = zip::ZipArchive::new(Cursor::new(result)).unwrap(); | ||
com.send_packet(&CEPPacket::Ack).unwrap(); | ||
|
||
let result_file = result_archive.by_name(&"3").unwrap(); | ||
assert_eq!(result_file.bytes().map(|b| b.unwrap()).collect::<Vec<_>>(), vec![0xde, 0xad]); | ||
|
||
assert_eq!(simulate_get_status(&mut com).unwrap(), [0]); | ||
} |
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