| 2174 | } |
| 2175 | |
| 2176 | void TestValidateErrors() { |
| 2177 | // Inconsistent is_valid / value |
| 2178 | RunEndEncodedScalar scalar_alpha{alpha_, type_}; |
| 2179 | scalar_alpha.is_valid = false; |
| 2180 | ASSERT_RAISES_WITH_MESSAGE(Invalid, |
| 2181 | std::string("Invalid: null run_end_encoded<run_ends: ") + |
| 2182 | run_end_type_->ToString() + |
| 2183 | ", values: string> scalar has non-null storage value", |
| 2184 | scalar_alpha.Validate()); |
| 2185 | |
| 2186 | auto null_scalar = MakeNullScalar(type_); |
| 2187 | null_scalar->is_valid = true; |
| 2188 | ASSERT_RAISES_WITH_MESSAGE( |
| 2189 | Invalid, |
| 2190 | std::string("Invalid: non-null run_end_encoded<run_ends: ") + |
| 2191 | run_end_type_->ToString() + ", values: string> scalar has null storage value", |
| 2192 | null_scalar->Validate()); |
| 2193 | |
| 2194 | // Bad value type |
| 2195 | auto ree_type = run_end_encoded(run_end_type_, int64()); |
| 2196 | RunEndEncodedScalar scalar_beta(beta_, ree_type); |
| 2197 | ASSERT_RAISES_WITH_MESSAGE( |
| 2198 | Invalid, |
| 2199 | std::string("Invalid: run_end_encoded<run_ends: ") + run_end_type_->ToString() + |
| 2200 | ", values: int64> scalar should have an underlying value of type int64, got " |
| 2201 | "string", |
| 2202 | scalar_beta.Validate()); |
| 2203 | |
| 2204 | // Invalid UTF8 |
| 2205 | auto bad_utf8 = std::make_shared<StringScalar>(Buffer::FromString("\xff")); |
| 2206 | RunEndEncodedScalar scalar(std::move(bad_utf8), type_); |
| 2207 | ASSERT_OK(scalar.Validate()); |
| 2208 | ASSERT_RAISES(Invalid, scalar.ValidateFull()); |
| 2209 | } |
| 2210 | |
| 2211 | void TestHashing() { |
| 2212 | std::unordered_set<std::shared_ptr<Scalar>, Scalar::Hash, Scalar::PtrsEqual> set; |
nothing calls this directly
no test coverage detected