mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
test input cases satisfied (wont' built)
This commit is contained in:
@@ -40,7 +40,10 @@ use super::{GenericGF, GenericGFPoly};
|
|||||||
#[test]
|
#[test]
|
||||||
fn testZero() {
|
fn testZero() {
|
||||||
assert_eq!(*FIELD.getZero(), *FIELD.buildMonomial(1, 0));
|
assert_eq!(*FIELD.getZero(), *FIELD.buildMonomial(1, 0));
|
||||||
assert_eq!(*FIELD.getZero(), *FIELD.buildMonomial(1, 2).multiply(0).unwrap());
|
assert_eq!(
|
||||||
|
*FIELD.getZero(),
|
||||||
|
*FIELD.buildMonomial(1, 2).multiply_with_scalar(0)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ impl GenericGF {
|
|||||||
/**
|
/**
|
||||||
* @return the monomial representing coefficient * x^degree
|
* @return the monomial representing coefficient * x^degree
|
||||||
*/
|
*/
|
||||||
pub fn buildMonomial(&self, degree: usize, coefficient: usize) -> Box<GenericGFPoly> {
|
pub fn buildMonomial(&self, degree: usize, coefficient: i32) -> Box<GenericGFPoly> {
|
||||||
if (coefficient == 0) {
|
if (coefficient == 0) {
|
||||||
return self.zero;
|
return self.zero;
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ impl fmt::Display for GenericGF {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct GenericGFPoly {
|
pub struct GenericGFPoly {
|
||||||
field: Box<GenericGF>,
|
field: Box<GenericGF>,
|
||||||
coefficients: Vec<usize>,
|
coefficients: Vec<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for GenericGFPoly {
|
impl PartialEq for GenericGFPoly {
|
||||||
@@ -280,7 +280,7 @@ impl GenericGFPoly {
|
|||||||
*/
|
*/
|
||||||
pub fn new(
|
pub fn new(
|
||||||
field: Box<GenericGF>,
|
field: Box<GenericGF>,
|
||||||
coefficients: &Vec<usize>,
|
coefficients: &Vec<i32>,
|
||||||
) -> Result<Self, IllegalArgumentException> {
|
) -> Result<Self, IllegalArgumentException> {
|
||||||
if (coefficients.len() == 0) {
|
if (coefficients.len() == 0) {
|
||||||
return Err(IllegalArgumentException::new(""));
|
return Err(IllegalArgumentException::new(""));
|
||||||
@@ -472,7 +472,7 @@ impl GenericGFPoly {
|
|||||||
pub fn multiplyByMonomial(
|
pub fn multiplyByMonomial(
|
||||||
&self,
|
&self,
|
||||||
degree: usize,
|
degree: usize,
|
||||||
coefficient: usize,
|
coefficient: i32,
|
||||||
) -> Result<Box<GenericGFPoly>, IllegalArgumentException> {
|
) -> Result<Box<GenericGFPoly>, IllegalArgumentException> {
|
||||||
if (degree < 0) {
|
if (degree < 0) {
|
||||||
return Err(IllegalArgumentException::new(""));
|
return Err(IllegalArgumentException::new(""));
|
||||||
|
|||||||
Reference in New Issue
Block a user