Skip to content

Commit 9e6ba3e

Browse files
authored
Update tests of variable-length-quantity (#2086)
closes #2081
1 parent 34cd147 commit 9e6ba3e

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

exercises/practice/variable-length-quantity/.meta/tests.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ description = "Encode a series of integers, producing a series of bytes. -> zero
1515
[be44d299-a151-4604-a10e-d4b867f41540]
1616
description = "Encode a series of integers, producing a series of bytes. -> arbitrary single byte"
1717

18+
[890bc344-cb80-45af-b316-6806a6971e81]
19+
description = "Encode a series of integers, producing a series of bytes. -> asymmetric single byte"
20+
1821
[ea399615-d274-4af6-bbef-a1c23c9e1346]
1922
description = "Encode a series of integers, producing a series of bytes. -> largest single byte"
2023

@@ -24,6 +27,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal
2427
[63955a49-2690-4e22-a556-0040648d6b2d]
2528
description = "Encode a series of integers, producing a series of bytes. -> arbitrary double byte"
2629

30+
[4977d113-251b-4d10-a3ad-2f5a7756bb58]
31+
description = "Encode a series of integers, producing a series of bytes. -> asymmetric double byte"
32+
2733
[29da7031-0067-43d3-83a7-4f14b29ed97a]
2834
description = "Encode a series of integers, producing a series of bytes. -> largest double byte"
2935

@@ -33,6 +39,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal
3339
[5df0bc2d-2a57-4300-a653-a75ee4bd0bee]
3440
description = "Encode a series of integers, producing a series of bytes. -> arbitrary triple byte"
3541

42+
[6731045f-1e00-4192-b5ae-98b22e17e9f7]
43+
description = "Encode a series of integers, producing a series of bytes. -> asymmetric triple byte"
44+
3645
[f51d8539-312d-4db1-945c-250222c6aa22]
3746
description = "Encode a series of integers, producing a series of bytes. -> largest triple byte"
3847

@@ -42,6 +51,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal
4251
[11ed3469-a933-46f1-996f-2231e05d7bb6]
4352
description = "Encode a series of integers, producing a series of bytes. -> arbitrary quadruple byte"
4453

54+
[b45ef770-cbba-48c2-bd3c-c6362679516e]
55+
description = "Encode a series of integers, producing a series of bytes. -> asymmetric quadruple byte"
56+
4557
[d5f3f3c3-e0f1-4e7f-aad0-18a44f223d1c]
4658
description = "Encode a series of integers, producing a series of bytes. -> largest quadruple byte"
4759

@@ -51,6 +63,9 @@ description = "Encode a series of integers, producing a series of bytes. -> smal
5163
[5f34ff12-2952-4669-95fe-2d11b693d331]
5264
description = "Encode a series of integers, producing a series of bytes. -> arbitrary quintuple byte"
5365

66+
[9be46731-7cd5-415c-b960-48061cbc1154]
67+
description = "Encode a series of integers, producing a series of bytes. -> asymmetric quintuple byte"
68+
5469
[7489694b-88c3-4078-9864-6fe802411009]
5570
description = "Encode a series of integers, producing a series of bytes. -> maximum 32-bit integer input"
5671

exercises/practice/variable-length-quantity/tests/variable_length_quantity.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ fn arbitrary_single_byte() {
1717
assert_eq!(output, expected);
1818
}
1919

20+
#[test]
21+
#[ignore]
22+
fn asymmetric_single_byte() {
23+
let input = &[83];
24+
let output = vlq::to_bytes(input);
25+
let expected = vec![0x53];
26+
assert_eq!(output, expected);
27+
}
28+
2029
#[test]
2130
#[ignore]
2231
fn largest_single_byte() {
@@ -44,6 +53,15 @@ fn arbitrary_double_byte() {
4453
assert_eq!(output, expected);
4554
}
4655

56+
#[test]
57+
#[ignore]
58+
fn asymmetric_double_byte() {
59+
let input = &[173];
60+
let output = vlq::to_bytes(input);
61+
let expected = vec![0x81, 0x2d];
62+
assert_eq!(output, expected);
63+
}
64+
4765
#[test]
4866
#[ignore]
4967
fn largest_double_byte() {
@@ -71,6 +89,15 @@ fn arbitrary_triple_byte() {
7189
assert_eq!(output, expected);
7290
}
7391

92+
#[test]
93+
#[ignore]
94+
fn asymmetric_triple_byte() {
95+
let input = &[120_220];
96+
let output = vlq::to_bytes(input);
97+
let expected = vec![0x87, 0xab, 0x1c];
98+
assert_eq!(output, expected);
99+
}
100+
74101
#[test]
75102
#[ignore]
76103
fn largest_triple_byte() {
@@ -98,6 +125,15 @@ fn arbitrary_quadruple_byte() {
98125
assert_eq!(output, expected);
99126
}
100127

128+
#[test]
129+
#[ignore]
130+
fn asymmetric_quadruple_byte() {
131+
let input = &[3_503_876];
132+
let output = vlq::to_bytes(input);
133+
let expected = vec![0x81, 0xd5, 0xee, 0x4];
134+
assert_eq!(output, expected);
135+
}
136+
101137
#[test]
102138
#[ignore]
103139
fn largest_quadruple_byte() {
@@ -125,6 +161,15 @@ fn arbitrary_quintuple_byte() {
125161
assert_eq!(output, expected);
126162
}
127163

164+
#[test]
165+
#[ignore]
166+
fn asymmetric_quintuple_byte() {
167+
let input = &[2_254_790_917];
168+
let output = vlq::to_bytes(input);
169+
let expected = vec![0x88, 0xb3, 0x95, 0xc2, 0x5];
170+
assert_eq!(output, expected);
171+
}
172+
128173
#[test]
129174
#[ignore]
130175
fn maximum_32_bit_integer_input() {

0 commit comments

Comments
 (0)