// SPDX-License-Identifier: MIT //! Not a transcribed test: the check the variants module's header promises. Python computes //! `IDEAL_VOLUME_TABLE` as `10 ** (-0.1 * step)`; Rust writes the numbers out (a `const` //! cannot call `powf`). Each must be that same `f64`, bit for bit. use sn76489::{variant, IDEAL_VOLUME_TABLE, VARIANTS}; #[test] fn the_written_out_volume_table_is_pythons_formula() { for (step, &value) in IDEAL_VOLUME_TABLE.iter().enumerate().take(15) { assert_eq!( value.to_bits(), 10f64.powf(-0.1 * step as f64).to_bits(), "step {step}" ); } assert_eq!(IDEAL_VOLUME_TABLE[15], 0.0); } #[test] fn every_part_is_found_by_its_name() { for part in VARIANTS { assert_eq!(variant(part.name), Some(part)); } assert_eq!(variant("SN76496"), None); }