Skip to content

Commit 1337a8e

Browse files
grinkersnewAM
authored andcommitted
Implement a test to ensure linking is done correctly.
"Note that this function does not take a handle, and so it can be called without opening a device" From the FTDI documentation, this appears to be one of the only calls we can actually test against without an FTDI device attached to the machine. Because Windows is linked dynamically, this would require a different test.
1 parent 74219d3 commit 1337a8e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use libftd2xx_ffi::FT_GetLibraryVersion;
2+
3+
#[test]
4+
#[cfg(not(windows))]
5+
fn version() {
6+
let mut dw_library_ver = 0;
7+
8+
let ft_status = unsafe { FT_GetLibraryVersion(&mut dw_library_ver) };
9+
assert_eq!(ft_status, 0);
10+
11+
// version "1.4.8" is represented as 0x010408
12+
assert_eq!(dw_library_ver, 0x01_04_08);
13+
}

0 commit comments

Comments
 (0)