Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
dmi
Commits
df986494
Commit
df986494
authored
Apr 12, 2018
by
Joshua Abraham
Browse files
Add unit tests for is_valid method
parent
aebe548b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/tests.rs
0 → 100644
View file @
df986494
extern
crate
dmi
;
#[test]
fn
table_checksum_is_valid
()
{
let
s
=
dmi
::
Smbios
{
anchor
:
*
b"_SM_"
,
checksum
:
0xc2
,
length
:
0x1f
,
major_version
:
0x02
,
minor_version
:
0x07
,
max_structure_size
:
0xb8
,
revision
:
0x00
,
formatted
:
[
0x00
,
0x00
,
0x00
,
0x00
,
0x00
],
inter_anchor
:
*
b"_DMI_"
,
inter_checksum
:
0x3e
,
table_length
:
0x0c15
,
table_address
:
0x000e92f0
,
structure_count
:
0x0052
,
bcd_revision
:
27
,
};
assert
!
(
s
.is_valid
());
}
#[test]
fn
table_checksum_is_invalid
()
{
let
s
=
dmi
::
Smbios
{
anchor
:
*
b"_SM_"
,
checksum
:
0x00
,
length
:
0x1f
,
major_version
:
0x02
,
minor_version
:
0x07
,
max_structure_size
:
0xb8
,
revision
:
0x00
,
formatted
:
[
0x00
,
0x00
,
0x00
,
0x00
,
0x00
],
inter_anchor
:
*
b"_DMI_"
,
inter_checksum
:
0x3e
,
table_length
:
0x0c15
,
table_address
:
0x000e92f0
,
structure_count
:
0x0052
,
bcd_revision
:
27
,
};
assert
!
(
!
s
.is_valid
());
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment