Skip to content

Commit

Permalink
Merge pull request #26 from wangfenjin/test-uint
Browse files Browse the repository at this point in the history
add test for uint
  • Loading branch information
wangfenjin authored Sep 25, 2021
2 parents 395c858 + c7e83c2 commit 38cd5fe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/types/from_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,21 @@ mod test {
Ok(())
}

#[test]
fn test_unsigned_integer() -> Result<()> {
let db = Connection::open_in_memory()?;
let sql = "BEGIN;
CREATE TABLE unsigned_int (u1 utinyint, u2 usmallint, u4 uinteger, u8 ubigint);
INSERT INTO unsigned_int VALUES (255, 65535, 4294967295, 18446744073709551615);
END;";
db.execute_batch(sql)?;
let v = db.query_row("SELECT * FROM unsigned_int", [], |row| {
<(u8, u16, u32, u64)>::try_from(row)
})?;
assert_eq!(v, (255, 65535, 4294967295, 18446744073709551615));
Ok(())
}

#[test]
fn test_integral_ranges() -> Result<()> {
let db = Connection::open_in_memory()?;
Expand Down

0 comments on commit 38cd5fe

Please sign in to comment.