pub struct VectorFile {
pub algorithm: String,
pub source: String,
pub cases: Vec<BTreeMap<String, String>>,
pub path: PathBuf,
}Expand description
A loaded vector file.
Fields§
§algorithm: StringWhat the file says it is for.
source: StringWhere the vectors came from, for the record.
cases: Vec<BTreeMap<String, String>>The cases, each a map of field name to raw hex string.
path: PathBufWhere the file was found.
Implementations§
Source§impl VectorFile
impl VectorFile
Sourcepub fn load(name: &str) -> Option<VectorFile>
pub fn load(name: &str) -> Option<VectorFile>
Load testvectors/<name>.json, or None if it is not there.
A malformed file is an error rather than a miss: someone went to the trouble of providing it, and silently ignoring it would waste their effort in the most confusing way available.
Sourcepub fn load_from(dir: &Path, name: &str) -> Option<VectorFile>
pub fn load_from(dir: &Path, name: &str) -> Option<VectorFile>
load, reading from a directory the caller names.
Exists so the tests can point at a directory of their own rather than
setting IC_TEST_VECTORS – cargo runs a crate’s tests as threads in
one process, so mutating the environment races every sibling that reads
it.
Sourcepub fn load_or_report(name: &str) -> Option<VectorFile>
pub fn load_or_report(name: &str) -> Option<VectorFile>
Load, or print why nothing was checked and return None.
The message is the point. A skipped vector test should be visible in the
output of cargo test -- --nocapture, not inferred from its absence.