Further test cases

This commit is contained in:
Chris Wood
2024-01-02 15:43:34 +00:00
parent 8f9f0bfa42
commit 93bbb676d8
14 changed files with 22 additions and 8 deletions

View File

@@ -26,10 +26,10 @@ pub mod TelepenCommon {
let temp = contents.chars().nth(i).unwrap() as u32;
if temp >= 27 {
number.push_str(&(temp - 27).to_string());
number.push_str(&format!("{:0>2}", (temp - 27)));
}
else {
number.push_str(&(temp - 17).to_string());
number.push_str(&format!("{:0>2}", (temp - 17)));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

View File

@@ -0,0 +1 @@
11058474

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

View File

@@ -0,0 +1 @@
10398404

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

View File

@@ -0,0 +1 @@
10483931

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

View File

@@ -0,0 +1 @@
11193263

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

View File

@@ -0,0 +1 @@
11264314

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

View File

@@ -0,0 +1 @@
11188986

View File

@@ -45,7 +45,7 @@ fn telepen_numeric_test_case() {
BarcodeFormat::TELEPEN,
);
tester.add_test_complex(1, 1, 0, 0, 0.0);
tester.add_test_complex(7, 1, 0, 0, 0.0);
tester.add_hint(rxing::DecodeHintType::TELEPEN_AS_NUMERIC, rxing::DecodeHintValue::TelepenAsNumeric(true));
tester.ignore_pure = true;
@@ -68,14 +68,22 @@ fn telepen_checksum_test2() {
#[test]
fn telepen_alpha_to_numeric_test() {
let ascii = "'=Siu";
let result = TelepenCommon::ascii_to_numeric(ascii);
let mut ascii = "'=Siu";
let mut result = TelepenCommon::ascii_to_numeric(ascii);
assert_eq!("1234567890", result);
ascii = "& oe";
result = TelepenCommon::ascii_to_numeric(ascii);
assert_eq!("11058474", result);
}
#[test]
fn telepen_numeric_to_ascii_test() {
let numeric = "1234567890";
let result = TelepenCommon::numeric_to_ascii(numeric).unwrap();
let mut numeric = "1234567890";
let mut result = TelepenCommon::numeric_to_ascii(numeric).unwrap();
assert_eq!("'=Siu", result);
numeric = "11058474";
result = TelepenCommon::numeric_to_ascii(numeric).unwrap();
assert_eq!("& oe", result);
}