wave_27 test file + related code

This commit is contained in:
Martin Kavík 2024-05-28 12:57:51 +02:00
parent c6ef5c65a4
commit 8d330ae48b
7 changed files with 49 additions and 32 deletions

View file

@ -1,4 +1,5 @@
use std::sync::Mutex;
use std::rc::Rc;
use wellen::simple::Waveform;
mod wellen_helpers;
@ -14,9 +15,15 @@ fn show_window(window: tauri::Window) {
}
#[tauri::command(rename_all = "snake_case")]
fn load_waveform(store: tauri::State<Store>) {
let waveform =
wellen_helpers::read_from_bytes(include_bytes!("../../test_files/simple.vcd").to_vec());
fn load_waveform(test_file_name: Rc<String>, store: tauri::State<Store>) {
static SIMPLE_VCD: &'static[u8; 311] = include_bytes!("../../test_files/simple.vcd");
static WAVE_27_FST: &'static[u8; 28860652] = include_bytes!("../../test_files/wave_27.fst");
let chosen_file = match test_file_name.as_str() {
"simple.vcd" => SIMPLE_VCD.to_vec(),
"wave_27.fst" => WAVE_27_FST.to_vec(),
test_file_name => todo!("add {test_file_name} to the `test_files` folder")
};
let waveform = wellen_helpers::read_from_bytes(chosen_file);
let Ok(waveform) = waveform else {
panic!("VCD file reading failed")
};