Skip to content

Instantly share code, notes, and snippets.

@leopard627
Created January 16, 2019 15:38
Show Gist options
  • Save leopard627/578a30dd50d748ce377e8c8ac8d0dd6d to your computer and use it in GitHub Desktop.
Save leopard627/578a30dd50d748ce377e8c8ac8d0dd6d to your computer and use it in GitHub Desktop.
#[test]
fn method_test() {
let apple_ii = Computer{
serial: String::from("APPLEISBEST!!"),
model: String::from("APPLE II"),
cpu: 32,
ram: 1024 * 100,
};
let mac = Computer{
serial: String::from("MACISBEST!!!"),
model: String::from("MAC"),
cpu: 64,
ram: 2048 * 100,
};
println!("{:?}", mac.about_serial());
println!("{:?}", mac.about_ram());
println!("Mac CPU is better? {:?}", mac.has_better_cpu_than(&apple_ii));
println!("Mac RAM is better? {:?}", mac.has_better_ram_than(&apple_ii));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment