rss_expanded_image_2_result test case pass

This commit is contained in:
Henry Schimke
2022-12-16 13:04:55 -06:00
parent c0ffa2bb1c
commit 54d68c174d
19 changed files with 118 additions and 109 deletions

View File

@@ -26,6 +26,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser};
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct AddressBookParsedRXingResult {
names: Vec<String>,
nicknames: Vec<String>,

View File

@@ -59,6 +59,7 @@ lazy_static! {
*
* @author Sean Owen
*/
#[derive(Debug)]
pub struct CalendarParsedRXingResult {
summary: String,
start: i64,
@@ -363,3 +364,11 @@ impl CalendarParsedRXingResult {
self.longitude
}
}
impl PartialEq for CalendarParsedRXingResult {
fn eq(&self, other: &Self) -> bool {
self.summary == other.summary && self.start == other.start && self.startAllDay == other.startAllDay && self.end == other.end && self.endAllDay == other.endAllDay && self.location == other.location && self.organizer == other.organizer && self.attendees == other.attendees && self.description == other.description && self.latitude == other.latitude && self.longitude == other.longitude
}
}
impl Eq for CalendarParsedRXingResult {}

View File

@@ -24,6 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser};
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct EmailAddressParsedRXingResult {
tos: Vec<String>,
ccs: Vec<String>,

View File

@@ -33,9 +33,6 @@ use std::collections::HashMap;
use super::{ParsedRXingResult, ParsedRXingResultType};
pub const KILOGRAM: &'static str = "KG";
pub const POUND: &'static str = "LB";
/**
* Represents a parsed result that encodes extended product information as encoded
* by the RSS format, like weight, price, dates, etc.
@@ -43,7 +40,7 @@ pub const POUND: &'static str = "LB";
* @author Antonio Manuel Benjumea Conde, Servinform, S.A.
* @author Agustín Delgado, Servinform, S.A.
*/
#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq,Debug)]
pub struct ExpandedProductParsedRXingResult {
rawText: String,
productID: String,
@@ -73,6 +70,9 @@ impl ParsedRXingResult for ExpandedProductParsedRXingResult {
}
impl ExpandedProductParsedRXingResult {
pub const KILOGRAM: &'static str = "KG";
pub const POUND: &'static str = "LB";
pub fn new(
rawText: String,
productID: String,

View File

@@ -92,13 +92,13 @@ pub fn parse(result: &crate::RXingResult) -> Option<super::ParsedClientResult> {
"3100" | "3101" | "3102" | "3103" | "3104" | "3105" | "3106" | "3107" | "3108"
| "3109" => {
weight = value;
weightType = ExpandedProductParsedResult::KILOGRAM.into();
weightType = ExpandedProductParsedRXingResult::KILOGRAM.into();
weightIncrement = ai[3..].to_owned()
}
"3200" | "3201" | "3202" | "3203" | "3204" | "3205" | "3206" | "3207" | "3208"
| "3209" => {
weight = value;
weightType = ExpandedProductParsedResult::POUND.into();
weightType = ExpandedProductParsedRXingResult::POUND.into();
weightIncrement = ai[3..].to_owned();
}
"3920" | "3921" | "3922" | "3923" => {

View File

@@ -24,6 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType};
*
* @author Sean Owen
*/
#[derive(Debug)]
pub struct GeoParsedRXingResult {
latitude: f64,
longitude: f64,
@@ -116,3 +117,10 @@ impl GeoParsedRXingResult {
&self.query
}
}
impl PartialEq for GeoParsedRXingResult {
fn eq(&self, other: &Self) -> bool {
self.latitude == other.latitude && self.longitude == other.longitude && self.altitude == other.altitude && self.query == other.query
}
}
impl Eq for GeoParsedRXingResult{}

View File

@@ -23,6 +23,7 @@ use super::ParsedRXingResult;
*
* @author jbreiden@google.com (Jeff Breidenbach)
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct ISBNParsedRXingResult {
isbn: String,
}

View File

@@ -23,6 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType};
*
* @author dswitkin@google.com (Daniel Switkin)
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct ProductParsedRXingResult {
product_id: String,
normalized_product_id: String,

View File

@@ -24,6 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser};
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct SMSParsedRXingResult {
numbers: Vec<String>,
vias: Vec<String>,

View File

@@ -23,6 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType};
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct TelParsedRXingResult {
number: String,
telURI: String,

View File

@@ -24,6 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType};
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash, Debug)]
pub struct TextParsedRXingResult {
text: String,
language: String,

View File

@@ -23,6 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser, URIResultPar
*
* @author Sean Owen
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct URIParsedRXingResult {
uri: String,
title: String,

View File

@@ -21,6 +21,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType};
/**
* Represents a parsed result that encodes a Vehicle Identification Number (VIN).
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct VINParsedRXingResult {
vin: String,
world_manufacturer_id: String,

View File

@@ -23,6 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser};
*
* @author Vikram Aggarwal
*/
#[derive(PartialEq, Eq,Hash,Debug)]
pub struct WifiParsedRXingResult {
ssid: String,
networkEncryption: String,

View File

@@ -87,6 +87,7 @@ mod VINParsedResultTestCase;
#[cfg(test)]
mod WifiParsedResultTestCase;
#[derive(PartialEq, Eq, Debug)]
pub enum ParsedClientResult {
TextResult(TextParsedRXingResult),
TelResult(TelParsedRXingResult),