This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch cleanup_warnings
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
The following commit(s) were added to refs/heads/cleanup_warnings by this push:
new de47f41 types and casts
de47f41 is described below
commit de47f41adb8be961443b11bcf13707e556f2bf67
Author: Alexander Saydakov <[email protected]>
AuthorDate: Mon Mar 29 19:16:19 2021 -0700
types and casts
---
tuple/include/array_of_doubles_sketch_impl.hpp | 4 +--
tuple/include/tuple_sketch_impl.hpp | 14 ++++-----
tuple/test/array_of_doubles_sketch_test.cpp | 2 +-
tuple/test/tuple_a_not_b_test.cpp | 34 +++++++++++-----------
tuple/test/tuple_intersection_test.cpp | 24 ++++++++--------
tuple/test/tuple_jaccard_similarity_test.cpp | 10 +++----
tuple/test/tuple_sketch_allocation_test.cpp | 2 +-
tuple/test/tuple_sketch_test.cpp | 40 +++++++++++++-------------
tuple/test/tuple_union_test.cpp | 24 ++++++++--------
9 files changed, 77 insertions(+), 77 deletions(-)
diff --git a/tuple/include/array_of_doubles_sketch_impl.hpp
b/tuple/include/array_of_doubles_sketch_impl.hpp
index f81e544..b494d66 100644
--- a/tuple/include/array_of_doubles_sketch_impl.hpp
+++ b/tuple/include/array_of_doubles_sketch_impl.hpp
@@ -88,7 +88,7 @@ void
compact_array_of_doubles_sketch_alloc<A>::serialize(std::ostream& os) const
write(os, seed_hash);
write(os, this->theta_);
if (this->get_num_retained() > 0) {
- const uint32_t num_entries = this->entries_.size();
+ const uint32_t num_entries = static_cast<uint32_t>(this->entries_.size());
write(os, num_entries);
const uint32_t unused32 = 0;
write(os, unused32);
@@ -128,7 +128,7 @@ auto
compact_array_of_doubles_sketch_alloc<A>::serialize(unsigned header_size_by
ptr += copy_to_mem(seed_hash, ptr);
ptr += copy_to_mem((this->theta_), ptr);
if (this->get_num_retained() > 0) {
- const uint32_t num_entries = this->entries_.size();
+ const uint32_t num_entries = static_cast<uint32_t>(this->entries_.size());
ptr += copy_to_mem(num_entries, ptr);
ptr += sizeof(uint32_t); // unused
for (const auto& it: this->entries_) {
diff --git a/tuple/include/tuple_sketch_impl.hpp
b/tuple/include/tuple_sketch_impl.hpp
index 28e26e2..1eba1e6 100644
--- a/tuple/include/tuple_sketch_impl.hpp
+++ b/tuple/include/tuple_sketch_impl.hpp
@@ -315,7 +315,7 @@ uint64_t compact_tuple_sketch<S, A>::get_theta64() const {
template<typename S, typename A>
uint32_t compact_tuple_sketch<S, A>::get_num_retained() const {
- return entries_.size();
+ return static_cast<uint32_t>(entries_.size());
}
template<typename S, typename A>
@@ -367,7 +367,7 @@ void compact_tuple_sketch<S, A>::serialize(std::ostream&
os, const SerDe& sd) co
write(os, seed_hash);
if (!this->is_empty()) {
if (!is_single_item) {
- const uint32_t num_entries = entries_.size();
+ const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
write(os, num_entries);
const uint32_t unused32 = 0;
write(os, unused32);
@@ -412,7 +412,7 @@ auto compact_tuple_sketch<S, A>::serialize(unsigned
header_size_bytes, const Ser
ptr += copy_to_mem(seed_hash, ptr);
if (!this->is_empty()) {
if (!is_single_item) {
- const uint32_t num_entries = entries_.size();
+ const uint32_t num_entries = static_cast<uint32_t>(entries_.size());
ptr += copy_to_mem(num_entries, ptr);
ptr += sizeof(uint32_t); // unused
if (this->is_estimation_mode()) {
@@ -535,22 +535,22 @@ compact_tuple_sketch<S, A> compact_tuple_sketch<S,
A>::deserialize(const void* b
template<typename S, typename A>
auto compact_tuple_sketch<S, A>::begin() -> iterator {
- return iterator(entries_.data(), entries_.size(), 0);
+ return iterator(entries_.data(), static_cast<uint32_t>(entries_.size()), 0);
}
template<typename S, typename A>
auto compact_tuple_sketch<S, A>::end() -> iterator {
- return iterator(nullptr, 0, entries_.size());
+ return iterator(nullptr, 0, static_cast<uint32_t>(entries_.size()));
}
template<typename S, typename A>
auto compact_tuple_sketch<S, A>::begin() const -> const_iterator {
- return const_iterator(entries_.data(), entries_.size(), 0);
+ return const_iterator(entries_.data(),
static_cast<uint32_t>(entries_.size()), 0);
}
template<typename S, typename A>
auto compact_tuple_sketch<S, A>::end() const -> const_iterator {
- return const_iterator(nullptr, 0, entries_.size());
+ return const_iterator(nullptr, 0, static_cast<uint32_t>(entries_.size()));
}
template<typename S, typename A>
diff --git a/tuple/test/array_of_doubles_sketch_test.cpp
b/tuple/test/array_of_doubles_sketch_test.cpp
index 7a5e359..d40491f 100644
--- a/tuple/test/array_of_doubles_sketch_test.cpp
+++ b/tuple/test/array_of_doubles_sketch_test.cpp
@@ -75,7 +75,7 @@ TEST_CASE("aod sketch: serialization compatibility with java
- empty configured
}
TEST_CASE("aod sketch: serialization compatibility with java - non-empty no
entries", "[tuple_sketch]") {
- auto update_sketch =
update_array_of_doubles_sketch::builder().set_p(0.01).build();
+ auto update_sketch =
update_array_of_doubles_sketch::builder().set_p(0.01f).build();
std::vector<double> a = {1};
update_sketch.update(1, a);
REQUIRE_FALSE(update_sketch.is_empty());
diff --git a/tuple/test/tuple_a_not_b_test.cpp
b/tuple/test/tuple_a_not_b_test.cpp
index 7c9446c..84c1881 100644
--- a/tuple/test/tuple_a_not_b_test.cpp
+++ b/tuple/test/tuple_a_not_b_test.cpp
@@ -38,8 +38,8 @@ TEST_CASE("tuple a-not-b: empty", "[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: non empty no retained keys", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
- a.update(1, 1);
- auto b = update_tuple_sketch<float>::builder().set_p(0.001).build();
+ a.update(1, 1.0f);
+ auto b = update_tuple_sketch<float>::builder().set_p(0.001f).build();
tuple_a_not_b<float> a_not_b;
// B is still empty
@@ -51,7 +51,7 @@ TEST_CASE("tuple a-not-b: non empty no retained keys",
"[tuple_a_not_b]") {
REQUIRE(result.get_estimate() == 1.0);
// B is not empty in estimation mode and no entries
- b.update(1, 1);
+ b.update(1, 1.0f);
REQUIRE(b.get_num_retained() == 0);
result = a_not_b.compute(a, b);
@@ -65,11 +65,11 @@ TEST_CASE("tuple a-not-b: non empty no retained keys",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: exact mode half overlap", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) a.update(value++, 1);
+ for (int i = 0; i < 1000; i++) a.update(value++, 1.0f);
auto b = update_tuple_sketch<float>::builder().build();
value = 500;
- for (int i = 0; i < 1000; i++) b.update(value++, 1);
+ for (int i = 0; i < 1000; i++) b.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -105,7 +105,7 @@ TEST_CASE("tuple a-not-b: exact mode half overlap",
"[tuple_a_not_b]") {
TEST_CASE("mixed a-not-b: exact mode half overlap", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) a.update(value++, 1);
+ for (int i = 0; i < 1000; i++) a.update(value++, 1.0f);
auto b = update_theta_sketch::builder().build();
value = 500;
@@ -145,10 +145,10 @@ TEST_CASE("mixed a-not-b: exact mode half overlap",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: exact mode disjoint", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) a.update(value++, 1);
+ for (int i = 0; i < 1000; i++) a.update(value++, 1.0f);
auto b = update_tuple_sketch<float>::builder().build();
- for (int i = 0; i < 1000; i++) b.update(value++, 1);
+ for (int i = 0; i < 1000; i++) b.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -168,7 +168,7 @@ TEST_CASE("tuple a-not-b: exact mode disjoint",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: exact mode full overlap", "[tuple_a_not_b]") {
auto sketch = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) sketch.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -188,11 +188,11 @@ TEST_CASE("tuple a-not-b: exact mode full overlap",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: estimation mode half overlap", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) a.update(value++, 1);
+ for (int i = 0; i < 10000; i++) a.update(value++, 1.0f);
auto b = update_tuple_sketch<float>::builder().build();
value = 5000;
- for (int i = 0; i < 10000; i++) b.update(value++, 1);
+ for (int i = 0; i < 10000; i++) b.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -212,10 +212,10 @@ TEST_CASE("tuple a-not-b: estimation mode half overlap",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: estimation mode disjoint", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) a.update(value++, 1);
+ for (int i = 0; i < 10000; i++) a.update(value++, 1.0f);
auto b = update_tuple_sketch<float>::builder().build();
- for (int i = 0; i < 10000; i++) b.update(value++, 1);
+ for (int i = 0; i < 10000; i++) b.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -235,7 +235,7 @@ TEST_CASE("tuple a-not-b: estimation mode disjoint",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: estimation mode full overlap", "[tuple_a_not_b]") {
auto sketch = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) sketch.update(value++, 1);
+ for (int i = 0; i < 10000; i++) sketch.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
@@ -254,7 +254,7 @@ TEST_CASE("tuple a-not-b: estimation mode full overlap",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: seed mismatch", "[tuple_a_not_b]") {
auto sketch = update_tuple_sketch<float>::builder().build();
- sketch.update(1, 1); // non-empty should not be ignored
+ sketch.update(1, 1.0f); // non-empty should not be ignored
tuple_a_not_b<float> a_not_b(123);
REQUIRE_THROWS_AS(a_not_b.compute(sketch, sketch), std::invalid_argument);
}
@@ -262,11 +262,11 @@ TEST_CASE("tuple a-not-b: seed mismatch",
"[tuple_a_not_b]") {
TEST_CASE("tuple a-not-b: issue #152", "[tuple_a_not_b]") {
auto a = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) a.update(value++, 1);
+ for (int i = 0; i < 10000; i++) a.update(value++, 1.0f);
auto b = update_tuple_sketch<float>::builder().build();
value = 5000;
- for (int i = 0; i < 25000; i++) b.update(value++, 1);
+ for (int i = 0; i < 25000; i++) b.update(value++, 1.0f);
tuple_a_not_b<float> a_not_b;
diff --git a/tuple/test/tuple_intersection_test.cpp
b/tuple/test/tuple_intersection_test.cpp
index 06ccd76..d3a26b9 100644
--- a/tuple/test/tuple_intersection_test.cpp
+++ b/tuple/test/tuple_intersection_test.cpp
@@ -59,8 +59,8 @@ TEST_CASE("tuple intersection: empty",
"[tuple_intersection]") {
}
TEST_CASE("tuple intersection: non empty no retained keys",
"[tuple_intersection]") {
- auto sketch = update_tuple_sketch<float>::builder().set_p(0.001).build();
- sketch.update(1, 1);
+ auto sketch = update_tuple_sketch<float>::builder().set_p(0.001f).build();
+ sketch.update(1, 1.0f);
tuple_intersection_float intersection;
intersection.update(sketch);
auto result = intersection.get_result();
@@ -82,11 +82,11 @@ TEST_CASE("tuple intersection: non empty no retained keys",
"[tuple_intersection
TEST_CASE("tuple intersection: exact mode half overlap",
"[tuple_intersection]") {
auto sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) sketch1.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch1.update(value++, 1.0f);
auto sketch2 = update_tuple_sketch<float>::builder().build();
value = 500;
- for (int i = 0; i < 1000; i++) sketch2.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch2.update(value++, 1.0f);
{ // unordered
tuple_intersection_float intersection;
@@ -111,10 +111,10 @@ TEST_CASE("tuple intersection: exact mode half overlap",
"[tuple_intersection]")
TEST_CASE("tuple intersection: exact mode disjoint", "[tuple_intersection]") {
auto sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) sketch1.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch1.update(value++, 1.0f);
auto sketch2 = update_tuple_sketch<float>::builder().build();
- for (int i = 0; i < 1000; i++) sketch2.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch2.update(value++, 1.0f);
{ // unordered
tuple_intersection_float intersection;
@@ -139,7 +139,7 @@ TEST_CASE("tuple intersection: exact mode disjoint",
"[tuple_intersection]") {
TEST_CASE("mixed intersection: exact mode half overlap",
"[tuple_intersection]") {
auto sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; i++) sketch1.update(value++, 1);
+ for (int i = 0; i < 1000; i++) sketch1.update(value++, 1.0f);
auto sketch2 = update_theta_sketch::builder().build();
value = 500;
@@ -168,11 +168,11 @@ TEST_CASE("mixed intersection: exact mode half overlap",
"[tuple_intersection]")
TEST_CASE("tuple intersection: estimation mode half overlap",
"[tuple_intersection]") {
auto sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) sketch1.update(value++, 1);
+ for (int i = 0; i < 10000; i++) sketch1.update(value++, 1.0f);
auto sketch2 = update_tuple_sketch<float>::builder().build();
value = 5000;
- for (int i = 0; i < 10000; i++) sketch2.update(value++, 1);
+ for (int i = 0; i < 10000; i++) sketch2.update(value++, 1.0f);
{ // unordered
tuple_intersection_float intersection;
@@ -197,10 +197,10 @@ TEST_CASE("tuple intersection: estimation mode half
overlap", "[tuple_intersecti
TEST_CASE("tuple intersection: estimation mode disjoint",
"[tuple_intersection]") {
auto sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; i++) sketch1.update(value++, 1);
+ for (int i = 0; i < 10000; i++) sketch1.update(value++, 1.0f);
auto sketch2 = update_tuple_sketch<float>::builder().build();
- for (int i = 0; i < 10000; i++) sketch2.update(value++, 1);
+ for (int i = 0; i < 10000; i++) sketch2.update(value++, 1.0f);
{ // unordered
tuple_intersection_float intersection;
@@ -224,7 +224,7 @@ TEST_CASE("tuple intersection: estimation mode disjoint",
"[tuple_intersection]"
TEST_CASE("tuple intersection: seed mismatch", "[tuple_intersection]") {
auto sketch = update_tuple_sketch<float>::builder().build();
- sketch.update(1, 1); // non-empty should not be ignored
+ sketch.update(1, 1.0f); // non-empty should not be ignored
tuple_intersection_float intersection(123);
REQUIRE_THROWS_AS(intersection.update(sketch), std::invalid_argument);
}
diff --git a/tuple/test/tuple_jaccard_similarity_test.cpp
b/tuple/test/tuple_jaccard_similarity_test.cpp
index 2b3efbb..0c957db 100644
--- a/tuple/test/tuple_jaccard_similarity_test.cpp
+++ b/tuple/test/tuple_jaccard_similarity_test.cpp
@@ -44,7 +44,7 @@ TEST_CASE("tuple jaccard: empty", "[tuple_sketch]") {
TEST_CASE("tuple jaccard: same sketch exact mode", "[tuple_sketch]") {
auto sk = update_tuple_sketch<float>::builder().build();
- for (int i = 0; i < 1000; ++i) sk.update(i, 1);
+ for (int i = 0; i < 1000; ++i) sk.update(i, 1.0f);
// update sketch
auto jc = tuple_jaccard_similarity_float::jaccard(sk, sk);
@@ -61,8 +61,8 @@ TEST_CASE("tuple jaccard: full overlap exact mode",
"[tuple_sketch]") {
auto sk_a = update_tuple_sketch<float>::builder().build();
auto sk_b = update_tuple_sketch<float>::builder().build();
for (int i = 0; i < 1000; ++i) {
- sk_a.update(i, 1);
- sk_b.update(i, 1);
+ sk_a.update(i, 1.0f);
+ sk_b.update(i, 1.0f);
}
// update sketches
@@ -83,8 +83,8 @@ TEST_CASE("tuple jaccard: disjoint exact mode",
"[tuple_sketch]") {
auto sk_a = update_tuple_sketch<float>::builder().build();
auto sk_b = update_tuple_sketch<float>::builder().build();
for (int i = 0; i < 1000; ++i) {
- sk_a.update(i, 1);
- sk_b.update(i + 1000, 1);
+ sk_a.update(i, 1.0f);
+ sk_b.update(i + 1000, 1.0f);
}
// update sketches
diff --git a/tuple/test/tuple_sketch_allocation_test.cpp
b/tuple/test/tuple_sketch_allocation_test.cpp
index a8e279a..4e834e8 100644
--- a/tuple/test/tuple_sketch_allocation_test.cpp
+++ b/tuple/test/tuple_sketch_allocation_test.cpp
@@ -64,7 +64,7 @@ TEST_CASE("tuple sketch with test allocator: estimation
mode", "[tuple_sketch]")
REQUIRE(count == update_sketch.get_num_retained());
update_sketch.trim();
- REQUIRE(update_sketch.get_num_retained() == (1 <<
update_sketch.get_lg_k()));
+ REQUIRE(update_sketch.get_num_retained() == (1U <<
update_sketch.get_lg_k()));
auto compact_sketch = update_sketch.compact();
REQUIRE(!compact_sketch.is_empty());
diff --git a/tuple/test/tuple_sketch_test.cpp b/tuple/test/tuple_sketch_test.cpp
index ec5d959..e6a87f1 100644
--- a/tuple/test/tuple_sketch_test.cpp
+++ b/tuple/test/tuple_sketch_test.cpp
@@ -40,7 +40,7 @@ namespace datasketches {
TEST_CASE("tuple sketch float: builder", "[tuple_sketch]") {
auto builder = update_tuple_sketch<float>::builder();
-
builder.set_lg_k(10).set_p(0.5).set_resize_factor(theta_constants::resize_factor::X2).set_seed(123);
+
builder.set_lg_k(10).set_p(0.5f).set_resize_factor(theta_constants::resize_factor::X2).set_seed(123);
auto sketch = builder.build();
REQUIRE(sketch.get_lg_k() == 10);
REQUIRE(sketch.get_theta() == 0.5);
@@ -74,9 +74,9 @@ TEST_CASE("tuple sketch float: empty", "[tuple_sketch]") {
TEST_CASE("tuple sketch float: exact mode", "[tuple_sketch]") {
auto update_sketch = update_tuple_sketch<float>::builder().build();
- update_sketch.update(1, 1);
- update_sketch.update(2, 2);
- update_sketch.update(1, 1);
+ update_sketch.update(1, 1.0f);
+ update_sketch.update(2, 2.0f);
+ update_sketch.update(1, 1.0f);
// std::cout << update_sketch.to_string(true);
REQUIRE(!update_sketch.is_empty());
REQUIRE(!update_sketch.is_estimation_mode());
@@ -167,11 +167,11 @@ using max_float_update_tuple_sketch =
update_tuple_sketch<float, float, max_valu
TEST_CASE("tuple sketch: float, custom policy", "[tuple_sketch]") {
auto update_sketch =
max_float_update_tuple_sketch::builder(max_value_policy<float>(5)).build();
- update_sketch.update(1, 1);
- update_sketch.update(1, 2);
- update_sketch.update(2, 10);
- update_sketch.update(3, 3);
- update_sketch.update(3, 7);
+ update_sketch.update(1, 1.0f);
+ update_sketch.update(1, 2.0f);
+ update_sketch.update(2, 10.0f);
+ update_sketch.update(3, 3.0f);
+ update_sketch.update(3, 7.0f);
// std::cout << update_sketch.to_string(true);
int count = 0;
float sum = 0;
@@ -212,37 +212,37 @@ TEST_CASE("tuple sketch: tuple of doubles",
"[tuple_sketch]") {
TEST_CASE("tuple sketch: float, update with different types of keys",
"[tuple_sketch]") {
auto sketch = update_tuple_sketch<float>::builder().build();
- sketch.update(static_cast<uint64_t>(1), 1);
+ sketch.update(static_cast<uint64_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<int64_t>(1), 1);
+ sketch.update(static_cast<int64_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<uint32_t>(1), 1);
+ sketch.update(static_cast<uint32_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<int32_t>(1), 1);
+ sketch.update(static_cast<int32_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<uint16_t>(1), 1);
+ sketch.update(static_cast<uint16_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<int16_t>(1), 1);
+ sketch.update(static_cast<int16_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<uint8_t>(1), 1);
+ sketch.update(static_cast<uint8_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(static_cast<int8_t>(1), 1);
+ sketch.update(static_cast<int8_t>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 1);
- sketch.update(1.0, 1);
+ sketch.update(1.0, 1.0f);
REQUIRE(sketch.get_num_retained() == 2);
- sketch.update(static_cast<float>(1), 1);
+ sketch.update(static_cast<float>(1), 1.0f);
REQUIRE(sketch.get_num_retained() == 2);
- sketch.update("a", 1);
+ sketch.update("a", 1.0f);
REQUIRE(sketch.get_num_retained() == 3);
}
diff --git a/tuple/test/tuple_union_test.cpp b/tuple/test/tuple_union_test.cpp
index 4088fa2..10c9a25 100644
--- a/tuple/test/tuple_union_test.cpp
+++ b/tuple/test/tuple_union_test.cpp
@@ -51,9 +51,9 @@ TEST_CASE("tupe_union float: empty theta sketch", "[tuple
union]") {
}
TEST_CASE("tuple_union float: non-empty no retained entries", "[tuple union]")
{
- auto update_sketch =
update_tuple_sketch<float>::builder().set_p(0.001).build();
+ auto update_sketch =
update_tuple_sketch<float>::builder().set_p(0.001f).build();
// std::cout << update_sketch.to_string();
- update_sketch.update(1, 1);
+ update_sketch.update(1, 1.0f);
REQUIRE(!update_sketch.is_empty());
REQUIRE(update_sketch.get_num_retained() == 0);
auto u = tuple_union<float>::builder().build();
@@ -69,12 +69,12 @@ TEST_CASE("tuple_union float: non-empty no retained
entries", "[tuple union]") {
TEST_CASE("tuple_union float: simple case", "[tuple union]") {
auto update_sketch1 = update_tuple_sketch<float>::builder().build();
- update_sketch1.update(1, 1);
- update_sketch1.update(2, 1);
+ update_sketch1.update(1, 1.0f);
+ update_sketch1.update(2, 1.0f);
auto update_sketch2 = update_tuple_sketch<float>::builder().build();
- update_sketch2.update(1, 1);
- update_sketch2.update(3, 1);
+ update_sketch2.update(1, 1.0f);
+ update_sketch2.update(3, 1.0f);
auto u = tuple_union<float>::builder().build();
u.update(update_sketch1);
@@ -86,11 +86,11 @@ TEST_CASE("tuple_union float: simple case", "[tuple
union]") {
TEST_CASE("tuple_union float: exact mode half overlap", "[tuple union]") {
auto update_sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 1000; ++i) update_sketch1.update(value++, 1);
+ for (int i = 0; i < 1000; ++i) update_sketch1.update(value++, 1.0f);
auto update_sketch2 = update_tuple_sketch<float>::builder().build();
value = 500;
- for (int i = 0; i < 1000; ++i) update_sketch2.update(value++, 1);
+ for (int i = 0; i < 1000; ++i) update_sketch2.update(value++, 1.0f);
{ // unordered
auto u = tuple_union<float>::builder().build();
@@ -115,11 +115,11 @@ TEST_CASE("tuple_union float: exact mode half overlap",
"[tuple union]") {
TEST_CASE("tuple_union float: estimation mode half overlap", "[tuple union]") {
auto update_sketch1 = update_tuple_sketch<float>::builder().build();
int value = 0;
- for (int i = 0; i < 10000; ++i) update_sketch1.update(value++, 1);
+ for (int i = 0; i < 10000; ++i) update_sketch1.update(value++, 1.0f);
auto update_sketch2 = update_tuple_sketch<float>::builder().build();
value = 5000;
- for (int i = 0; i < 10000; ++i) update_sketch2.update(value++, 1);
+ for (int i = 0; i < 10000; ++i) update_sketch2.update(value++, 1.0f);
{ // unordered
auto u = tuple_union<float>::builder().build();
@@ -143,7 +143,7 @@ TEST_CASE("tuple_union float: estimation mode half
overlap", "[tuple union]") {
TEST_CASE("tuple_union float: seed mismatch", "[tuple union]") {
auto update_sketch = update_tuple_sketch<float>::builder().build();
- update_sketch.update(1, 1); // non-empty should not be ignored
+ update_sketch.update(1, 1.0f); // non-empty should not be ignored
auto u = tuple_union<float>::builder().set_seed(123).build();
REQUIRE_THROWS_AS(u.update(update_sketch), std::invalid_argument);
@@ -154,7 +154,7 @@ TEST_CASE("tuple_union float: full overlap with theta
sketch", "[tuple union]")
// tuple update
auto update_tuple = update_tuple_sketch<float>::builder().build();
- for (unsigned i = 0; i < 10; ++i) update_tuple.update(i, 1);
+ for (unsigned i = 0; i < 10; ++i) update_tuple.update(i, 1.0f);
u.update(update_tuple);
// tuple compact
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]