added primary header tests
This commit is contained in:
@@ -7,14 +7,14 @@ pub type PacketType {
|
||||
Command
|
||||
}
|
||||
|
||||
fn packet_type_from_int(val: Int) -> PacketType {
|
||||
pub fn packet_type_from_int(val: Int) -> PacketType {
|
||||
case val {
|
||||
1 -> Command
|
||||
_ -> Telemetry
|
||||
}
|
||||
}
|
||||
|
||||
fn packet_type_to_int(val: PacketType) -> Int {
|
||||
pub fn packet_type_to_int(val: PacketType) -> Int {
|
||||
case val {
|
||||
Command -> 1
|
||||
Telemetry -> 0
|
||||
@@ -35,7 +35,7 @@ pub type SequenceFlags {
|
||||
Unsegmented
|
||||
}
|
||||
|
||||
fn sequence_flags_from_int(val: Int) -> SequenceFlags {
|
||||
pub fn sequence_flags_from_int(val: Int) -> SequenceFlags {
|
||||
case val {
|
||||
0b00 -> Continuation
|
||||
0b01 -> FirstSegment
|
||||
@@ -44,7 +44,7 @@ fn sequence_flags_from_int(val: Int) -> SequenceFlags {
|
||||
}
|
||||
}
|
||||
|
||||
fn sequence_flags_to_int(val: SequenceFlags) -> Int {
|
||||
pub fn sequence_flags_to_int(val: SequenceFlags) -> Int {
|
||||
case val {
|
||||
Continuation -> 0b00
|
||||
FirstSegment -> 0b01
|
||||
@@ -53,7 +53,7 @@ fn sequence_flags_to_int(val: SequenceFlags) -> Int {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn seq_flag_to_string(sp_seq_flags: SequenceFlags) -> String {
|
||||
pub fn sequence_flags_to_string(sp_seq_flags: SequenceFlags) -> String {
|
||||
case sp_seq_flags {
|
||||
Continuation -> "Continuation"
|
||||
FirstSegment -> "First Segment"
|
||||
@@ -93,7 +93,7 @@ pub fn to_string(hdr: PrimaryHeader) -> String {
|
||||
|> string_tree.append(int.to_base16(hdr.apid))
|
||||
|> string_tree.append("\n")
|
||||
|> string_tree.append("Sequence Flags: ")
|
||||
|> string_tree.append(seq_flag_to_string(hdr.seq_flag))
|
||||
|> string_tree.append(sequence_flags_to_string(hdr.seq_flag))
|
||||
|> string_tree.append("\n")
|
||||
|> string_tree.append("Sequence Count: ")
|
||||
|> string_tree.append(int.to_string(hdr.seq_count))
|
||||
|
||||
Reference in New Issue
Block a user