most uri pass docomo and exotic fail

This commit is contained in:
Henry Schimke
2022-09-08 12:34:12 -05:00
parent 9c7beb2073
commit c7db80cfb8
10 changed files with 449 additions and 344 deletions

View File

@@ -33,21 +33,21 @@ use crate::{BarcodeFormat, RXingResult, client::result::{ParsedRXingResult, Pars
use super::ResultParser;
#[test]
fn testProduct() {
doTest("123456789012", "123456789012", BarcodeFormat::UPC_A);
doTest("00393157", "00393157", BarcodeFormat::EAN_8);
doTest("5051140178499", "5051140178499", BarcodeFormat::EAN_13);
doTest("01234565", "012345000065", BarcodeFormat::UPC_E);
fn test_product() {
do_test("123456789012", "123456789012", BarcodeFormat::UPC_A);
do_test("00393157", "00393157", BarcodeFormat::EAN_8);
do_test("5051140178499", "5051140178499", BarcodeFormat::EAN_13);
do_test("01234565", "012345000065", BarcodeFormat::UPC_E);
}
fn doTest( contents:&str, normalized:&str, format:BarcodeFormat) {
let fakeRXingResult = RXingResult::new(contents, Vec::new(), Vec::new(), format);
let result = ResultParser::parseRXingResult(&fakeRXingResult);
fn do_test( contents:&str, normalized:&str, format:BarcodeFormat) {
let fake_rxing_result = RXingResult::new(contents, Vec::new(), Vec::new(), format);
let result = ResultParser::parseRXingResult(&fake_rxing_result);
assert_eq!(ParsedRXingResultType::PRODUCT, result.getType());
if let ParsedClientResult::ProductResult(productRXingResult) = result {
assert_eq!(contents, productRXingResult.getProductID());
assert_eq!(normalized, productRXingResult.getNormalizedProductID());
if let ParsedClientResult::ProductResult(product_rxing_result) = result {
assert_eq!(contents, product_rxing_result.getProductID());
assert_eq!(normalized, product_rxing_result.getNormalizedProductID());
}else{
panic!("Expected ParsedClientResult::ProductResult")
}