Skip to content

Commit

Permalink
added test for LoginAck
Browse files Browse the repository at this point in the history
  • Loading branch information
walf443 committed Jun 4, 2022
1 parent 20d61f4 commit 5c15ec8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sqlx-core/src/mssql/protocol/login_ack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::error::Error;
use crate::mssql::io::MssqlBufExt;
use crate::mssql::protocol::pre_login::Version;

#[allow(dead_code)]
#[derive(Debug)]
pub(crate) struct LoginAck {
pub(crate) interface: u8,
Expand Down Expand Up @@ -37,3 +38,23 @@ impl LoginAck {
})
}
}

#[test]
fn test_get() {
#[rustfmt::skip]
let mut buf = Bytes::from_static(&[
0x36, 0, 1, 0x74, 0, 0, 4, 0x16, 0x4d, 0, 0x69, 0, 0x63, 0, 0x72, 0, 0x6f, 0, 0x73, 0, 0x6f, 0, 0x66, 0, 0x74, 0, 0x20, 0, 0x53, 0, 51, 0, 0x4c, 0, 0x20, 0, 0x53, 0, 0x65, 0, 0x72, 0, 0x76, 0, 0x65, 0, 0x72, 0, 0, 0, 0, 0, 0xf, 0, 0x10, 0x7f, 0xe3, 0x13, 0, 4, 4, 0x34, 0, 0x30, 0, 0x39, 0, 0x36, 0, 4, 0x34, 0, 0x30, 0, 0x39, 0, 0x36, 0, 0xfd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]);

let login_ack = LoginAck::get(&mut buf).unwrap();

assert_eq!(login_ack.interface, 1);
assert_eq!(login_ack.tds_version, 67108980);

assert_eq!(login_ack.program_version.major, 15);
assert_eq!(login_ack.program_version.minor, 0);
assert_eq!(login_ack.program_version.build, 4223);
assert_eq!(login_ack.program_version.sub_build, 0);

assert_eq!(login_ack.program_name, "Microsoft S3L Server\0\0");
}

0 comments on commit 5c15ec8

Please sign in to comment.