Skip to content
Snippets Groups Projects
Commit 8d3a2432 authored by Samuel Tardieu's avatar Samuel Tardieu
Browse files

New fixed arithmetic tests

parent 4931ac8b
No related branches found
No related tags found
1 merge request!6Pid
use pid::Fixed;
type F16 = Fixed<16>;
#[test]
fn round() {
let v = F16::from_raw(0x10000);
assert_eq!(v.round(), 1);
let v = F16::from_raw(0xffff);
assert_eq!(v.round(), 1);
let v = F16::from_raw(0x8000);
assert_eq!(v.round(), 1);
let v = F16::from_raw(0x7fff);
assert_eq!(v.round(), 0);
let v = F16::from_raw(-0x10000);
assert_eq!(v.round(), -1);
let v = F16::from_raw(-0xffff);
assert_eq!(v.round(), -1);
let v = F16::from_raw(-0x8000);
assert_eq!(v.round(), -1);
let v = F16::from_raw(-0x7fff);
assert_eq!(v.round(), 0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment