UPDATE: Serialize/Deserialize with bitcode (#31)
* UPDATE: Serialize/Deserialize with bitcode Fixes #12
This commit is contained in:
committed by
GitHub
parent
489027991c
commit
196e074ef5
@@ -23,6 +23,7 @@ thiserror = "1.0"
|
||||
ironcalc_base = { path = "../base", version = "0.1.0" }
|
||||
itertools = "0.12"
|
||||
chrono = "0.4"
|
||||
bitcode = "0.6.0"
|
||||
|
||||
[dev-dependencies]
|
||||
uuid = { version = "1.2.2", features = ["serde", "v4"] }
|
||||
|
||||
26
xlsx/src/bin/xlsx_2_icalc.rs
Normal file
26
xlsx/src/bin/xlsx_2_icalc.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
//! Tests an Excel xlsx file.
|
||||
//! Returns a list of differences in json format.
|
||||
//! Saves an IronCalc version
|
||||
//! This is primary for QA internal testing and will be superseded by an official
|
||||
//! IronCalc CLI.
|
||||
//!
|
||||
//! Usage: test file.xlsx
|
||||
|
||||
use std::path;
|
||||
|
||||
use ironcalc::{export::save_to_json, import::load_model_from_xlsx};
|
||||
|
||||
fn main() {
|
||||
let args: Vec<_> = std::env::args().collect();
|
||||
if args.len() != 2 {
|
||||
panic!("Usage: {} <file.xlsx>", args[0]);
|
||||
}
|
||||
// first test the file
|
||||
let file_name = &args[1];
|
||||
|
||||
let file_path = path::Path::new(file_name);
|
||||
let base_name = file_path.file_stem().unwrap().to_str().unwrap();
|
||||
let output_file_name = &format!("{base_name}.ic");
|
||||
let model = load_model_from_xlsx(file_name, "en", "UTC").unwrap();
|
||||
save_to_json(model.workbook, output_file_name);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ fn test_simple_text() {
|
||||
fn test_defined_names_casing() {
|
||||
let test_file_path = "tests/calc_tests/defined_names_for_unit_test.xlsx";
|
||||
let loaded_workbook = load_from_excel(test_file_path, "en", "UTC").unwrap();
|
||||
let mut model = Model::from_json(&serde_json::to_string(&loaded_workbook).unwrap()).unwrap();
|
||||
let mut model = Model::from_bytes(&bitcode::encode(&loaded_workbook)).unwrap();
|
||||
|
||||
let (row, column) = (2, 13); // B13
|
||||
let test_cases = [
|
||||
|
||||
Reference in New Issue
Block a user