use std::collections::HashMap;
use torq_lang::klvm::value::{Comp, Scalar, ScalarOrComp, ToBeDefined};
#[test]
fn show_rust_sizes() {
println!("bool size: {}", size_of_val(&true));
println!("char size: {}", size_of_val(&'x'));
println!("i32 size: {}", size_of_val(&1));
println!("f32 size: {}", size_of_val(&1f32));
println!("i64 size: {}", size_of_val(&1i64));
println!("f64 size: {}", size_of_val(&1f64));
let s = "Hello";
println!("&str size: {}", size_of_val(&s));
let s: Option<&str> = Some("Hello");
println!("Some(&str) size: {}", size_of_val(&s));
let s: Option<&str> = None;
println!("None of &str size: {}", size_of_val(&s));
let s = String::from("Hello");
println!("String size: {}", size_of_val(&s));
println!("vec![true] size: {}", size_of_val(&vec![true]));
println!(
"HashMap (empty) size: {}",
size_of_val(&HashMap::<i32, i32>::new())
);
}
#[test]
fn show_torq_sizes() {
let v = Scalar::Bool(true);
println!("Scalar::Bool(true) size: {}", size_of_val(&v));
assert_eq!(16, size_of_val(&v));
let v = Comp::Rec(ToBeDefined::new());
println!("Comp::Rec(ToBeDefined::new()) size: {}", size_of_val(&v));
assert_eq!(32, size_of_val(&v));
let v = ScalarOrComp::Scalar(Scalar::Bool(false));
println!(
"ScalarOrComp::Scalar(Scalar::Bool(false)) size: {}",
size_of_val(&v)
);
assert_eq!(32, size_of_val(&v));
let v = ScalarOrComp::Comp(Comp::Rec(ToBeDefined::new()));
println!(
"ScalarOrComp::Comp(Comp::Rec(ToBeDefined::new())) size: {}",
size_of_val(&v)
);
assert_eq!(32, size_of_val(&v));
}