From faeb07f303894b6be6234c7988fc7b358fd6d02f Mon Sep 17 00:00:00 2001
From: Dagobert Michelsen <dam@opencsw.org>
Date: Wed, 25 Sep 2013 15:21:43 +0200
Subject: [PATCH] Force float to disambiguise float/double invocation of log
---
tests/api_weight.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/api_weight.cc b/tests/api_weight.cc
index 792a7ae..b03d8c5 100644
a
|
b
|
DEFINE_TESTCASE(tfidfweight3, backend) {
|
141 | 141 | TEST_EQUAL(mset.size(), 2); |
142 | 142 | // doc 2 should have higher weight than 4 as only tf(wdf) will dominate. |
143 | 143 | mset_expect_order(mset, 2, 4); |
144 | | TEST_EQUAL_DOUBLE(mset[0].get_weight(), (8 * log(6 / 2))); |
| 144 | TEST_EQUAL_DOUBLE(mset[0].get_weight(), (8 * log(6.0f / 2))); |
145 | 145 | |
146 | 146 | // Check for "bnn" and for both branches of 'b'. |
147 | 147 | enquire.set_query(Xapian::Query("test")); |
… |
… |
DEFINE_TESTCASE(tfidfweight3, backend) {
|
157 | 157 | mset = enquire.get_mset(0, 10); |
158 | 158 | TEST_EQUAL(mset.size(), 2); |
159 | 159 | mset_expect_order(mset, 2, 4); |
160 | | TEST_EQUAL_DOUBLE(mset[0].get_weight(), (1 + log(8))); // idfn=1 and so wt=tfn=1+log(tf) |
| 160 | TEST_EQUAL_DOUBLE(mset[0].get_weight(), (1 + log(8.0f))); // idfn=1 and so wt=tfn=1+log(tf) |
161 | 161 | TEST_EQUAL_DOUBLE(mset[1].get_weight(), 1.0); // idfn=1 and wt=tfn=1+log(tf)=1+log(1)=1 |
162 | 162 | |
163 | 163 | // Check for "snn" |
… |
… |
DEFINE_TESTCASE(tfidfweight3, backend) {
|
194 | 194 | mset = enquire.get_mset(0, 10); |
195 | 195 | TEST_EQUAL(mset.size(), 2); |
196 | 196 | mset_expect_order(mset, 2, 4); |
197 | | TEST_EQUAL_DOUBLE(mset[0].get_weight(), 8 * log((6 - 2) / 2)); |
198 | | TEST_EQUAL_DOUBLE(mset[1].get_weight(), 1 * log((6 - 2) / 2)); |
| 197 | TEST_EQUAL_DOUBLE(mset[0].get_weight(), 8 * log((6.0f - 2) / 2)); |
| 198 | TEST_EQUAL_DOUBLE(mset[1].get_weight(), 1 * log((6.0f - 2) / 2)); |
199 | 199 | |
200 | 200 | return true; |
201 | 201 | } |