mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
most uri pass docomo and exotic fail
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user