use super::{compute_file_hash, compute_inputs_hash};
use crate::core::template_versions::precommit::CODEGEN_FORMAT_VERSION;
const FIXTURE_SOURCES_HASH: &str = "0000000000000000000000000000000000000000000000000000000000000000";
const FIXTURE_ALEF_TOML: &[u8] = b"[workspace]\nlanguages = [\"python\"]\n";
const FIXTURE_FILE_BODY: &str = "fn fixture() {}\n";
const PINNED_CODEGEN_FORMAT_VERSION: &str = "2";
const GOLDEN_INPUTS_HASH: &str = "2aa40c183b09b9c8cb986ff8120d0a3a665b5ed82962149f2abf8856866df57c";
const GOLDEN_FILE_HASH: &str = "59ce25fe68a99c6e95ef5ee2fc47f31be1303ba8a755531c4b905afa591bde8a";
#[test]
fn inputs_hash_recipe_matches_its_recorded_revision() {
assert_eq!(
CODEGEN_FORMAT_VERSION, PINNED_CODEGEN_FORMAT_VERSION,
"CODEGEN_FORMAT_VERSION is the recorded revision of the stamp recipe; bumping it \
re-derives every alef:hash: value in every consumer repo, so the golden vectors in \
this file must be recomputed in the same commit"
);
assert_eq!(
compute_inputs_hash(FIXTURE_SOURCES_HASH, FIXTURE_ALEF_TOML),
GOLDEN_INPUTS_HASH,
"the inputs-hash recipe changed without a CODEGEN_FORMAT_VERSION bump; every stamp \
already written is now unverifiable and no regeneration explains why"
);
}
#[test]
fn file_hash_recipe_matches_its_recorded_revision() {
assert_eq!(
compute_file_hash(GOLDEN_INPUTS_HASH, FIXTURE_FILE_BODY),
GOLDEN_FILE_HASH,
"the per-file stamp recipe changed without a CODEGEN_FORMAT_VERSION bump; every stamp \
already written is now unverifiable and no regeneration explains why"
);
}