Lines Matching refs:w1
42 Weight w1 = weight_generator_(); variable
47 VLOG(1) << "w1 = " << w1;
51 TestSemiring(w1, w2, w3);
53 TestDivision(w1, w2);
54 TestReverse(w1, w2);
55 TestEquality(w1, w2, w3);
56 TestIO(w1);
57 TestCopy(w1);
66 void TestSemiring(Weight w1, Weight w2, Weight w3) { in TestSemiring() argument
68 CHECK(Plus(w1, w2).Member()); in TestSemiring()
69 CHECK(Times(w1, w2).Member()); in TestSemiring()
72 CHECK(ApproxEqual(Plus(w1, Plus(w2, w3)), Plus(Plus(w1, w2), w3))); in TestSemiring()
73 CHECK(ApproxEqual(Times(w1, Times(w2, w3)), Times(Times(w1, w2), w3))); in TestSemiring()
76 CHECK(Plus(w1, Weight::Zero()) == w1); in TestSemiring()
77 CHECK(Plus(Weight::Zero(), w1) == w1); in TestSemiring()
78 CHECK(Times(w1, Weight::One()) == w1); in TestSemiring()
79 CHECK(Times(Weight::One(), w1) == w1); in TestSemiring()
83 CHECK(!Plus(w1, Weight::NoWeight()).Member()); in TestSemiring()
84 CHECK(!Plus(Weight::NoWeight(), w1).Member()); in TestSemiring()
85 CHECK(!Times(w1, Weight::NoWeight()).Member()); in TestSemiring()
86 CHECK(!Times(Weight::NoWeight(), w1).Member()); in TestSemiring()
89 CHECK(ApproxEqual(Plus(w1, w2), Plus(w2, w1))); in TestSemiring()
91 CHECK(ApproxEqual(Times(w1, w2), Times(w2, w1))); in TestSemiring()
94 CHECK(Times(w1, Weight::Zero()) == Weight::Zero()); in TestSemiring()
95 CHECK(Times(Weight::Zero(), w1) == Weight::Zero()); in TestSemiring()
98 CHECK(Power(w1, 0) == Weight::One()); in TestSemiring()
101 CHECK(Power(w1, 1) == w1); in TestSemiring()
104 CHECK(Power(w1, 3) == Times(w1, Times(w1, w1))); in TestSemiring()
108 CHECK(ApproxEqual(Times(w1, Plus(w2, w3)), in TestSemiring()
109 Plus(Times(w1, w2), Times(w1, w3)))); in TestSemiring()
111 CHECK(ApproxEqual(Times(Plus(w1, w2), w3), in TestSemiring()
112 Plus(Times(w1, w3), Times(w2, w3)))); in TestSemiring()
115 CHECK(Plus(w1, w1) == w1); in TestSemiring()
118 CHECK(Plus(w1, w2) == w1 || Plus(w1, w2) == w2); in TestSemiring()
129 void TestDivision(Weight w1, Weight w2) { in TestDivision() argument
130 Weight p = Times(w1, w2); in TestDivision()
133 Weight d = Divide(p, w1, DIVIDE_LEFT); in TestDivision()
135 CHECK(ApproxEqual(p, Times(w1, d))); in TestDivision()
136 CHECK(!Divide(w1, Weight::NoWeight(), DIVIDE_LEFT).Member()); in TestDivision()
137 CHECK(!Divide(Weight::NoWeight(), w1, DIVIDE_LEFT).Member()); in TestDivision()
144 CHECK(!Divide(w1, Weight::NoWeight(), DIVIDE_RIGHT).Member()); in TestDivision()
145 CHECK(!Divide(Weight::NoWeight(), w1, DIVIDE_RIGHT).Member()); in TestDivision()
149 Weight d = Divide(p, w1, DIVIDE_RIGHT); in TestDivision()
151 CHECK(ApproxEqual(p, Times(d, w1))); in TestDivision()
156 void TestReverse(Weight w1, Weight w2) { in TestReverse() argument
159 ReverseWeight rw1 = w1.Reverse(); in TestReverse()
162 CHECK(rw1.Reverse() == w1); in TestReverse()
163 CHECK(Plus(w1, w2).Reverse() == Plus(rw1, rw2)); in TestReverse()
164 CHECK(Times(w1, w2).Reverse() == Times(rw2, rw1)); in TestReverse()
168 void TestEquality(Weight w1, Weight w2, Weight w3) { in TestEquality() argument
170 CHECK(w1 == w1); in TestEquality()
173 CHECK((w1 == w2) == (w2 == w1)); in TestEquality()
176 if (w1 == w2 && w2 == w3) in TestEquality()
177 CHECK(w1 == w3); in TestEquality()