share legacy XLS test helpers

This commit is contained in:
Dylan M. Taylor
2026-11-12 06:29:50 +00:00
parent 794b65ecac
commit b1bd8d8b20
2 changed files with 4 additions and 19 deletions
+1 -16
View File
@@ -5,24 +5,9 @@
use gridcraft_core::{CellRef, RangeRef};
use gridcraft_model::{CfOperator, ErrorStyle, Validation, ValidationKind, Workbook};
use super::xls_tests::compound;
use super::xls_tests::{cat, compound, rec, u16s};
use crate::{ReadReport, read_xls};
fn rec(id: u16, payload: &[u8]) -> Vec<u8> {
let mut v = id.to_le_bytes().to_vec();
v.extend_from_slice(&(payload.len() as u16).to_le_bytes());
v.extend_from_slice(payload);
v
}
fn cat(parts: &[&[u8]]) -> Vec<u8> {
parts.concat()
}
fn u16s(v: &[u16]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}
fn bof(dt: u16) -> Vec<u8> {
rec(0x0809, &cat(&[&u16s(&[0x0600, dt, 0x0DBB, 0x07CC]), &[0; 8]]))
}
+3 -3
View File
@@ -133,18 +133,18 @@ pub(crate) fn compound(name: &str, data: &[u8]) -> Vec<u8> {
out
}
fn rec(id: u16, payload: &[u8]) -> Vec<u8> {
pub(super) fn rec(id: u16, payload: &[u8]) -> Vec<u8> {
let mut v = id.to_le_bytes().to_vec();
v.extend_from_slice(&(payload.len() as u16).to_le_bytes());
v.extend_from_slice(payload);
v
}
fn cat(parts: &[&[u8]]) -> Vec<u8> {
pub(super) fn cat(parts: &[&[u8]]) -> Vec<u8> {
parts.concat()
}
fn u16s(v: &[u16]) -> Vec<u8> {
pub(super) fn u16s(v: &[u16]) -> Vec<u8> {
v.iter().flat_map(|x| x.to_le_bytes()).collect()
}