| 2114 | } |
| 2115 | |
| 2116 | void TestValidateErrors() { |
| 2117 | // Inconsistent is_valid / value |
| 2118 | RunEndEncodedScalar scalar_alpha{alpha_, type_}; |
| 2119 | scalar_alpha.is_valid = false; |
| 2120 | ASSERT_RAISES_WITH_MESSAGE(Invalid, |
| 2121 | std::string("Invalid: null run_end_encoded<run_ends: ") + |
| 2122 | run_end_type_->ToString() + |
| 2123 | ", values: string> scalar has non-null storage value", |
| 2124 | scalar_alpha.Validate()); |
| 2125 | |
| 2126 | auto null_scalar = MakeNullScalar(type_); |
| 2127 | null_scalar->is_valid = true; |
| 2128 | ASSERT_RAISES_WITH_MESSAGE( |
| 2129 | Invalid, |
| 2130 | std::string("Invalid: non-null run_end_encoded<run_ends: ") + |
| 2131 | run_end_type_->ToString() + ", values: string> scalar has null storage value", |
| 2132 | null_scalar->Validate()); |
| 2133 | |
| 2134 | // Bad value type |
| 2135 | auto ree_type = run_end_encoded(run_end_type_, int64()); |
| 2136 | RunEndEncodedScalar scalar_beta(beta_, ree_type); |
| 2137 | ASSERT_RAISES_WITH_MESSAGE( |
| 2138 | Invalid, |
| 2139 | std::string("Invalid: run_end_encoded<run_ends: ") + run_end_type_->ToString() + |
| 2140 | ", values: int64> scalar should have an underlying value of type int64, got " |
| 2141 | "string", |
| 2142 | scalar_beta.Validate()); |
| 2143 | |
| 2144 | // Invalid UTF8 |
| 2145 | auto bad_utf8 = std::make_shared<StringScalar>(Buffer::FromString("\xff")); |
| 2146 | RunEndEncodedScalar scalar(std::move(bad_utf8), type_); |
| 2147 | ASSERT_OK(scalar.Validate()); |
| 2148 | ASSERT_RAISES(Invalid, scalar.ValidateFull()); |
| 2149 | } |
| 2150 | |
| 2151 | void TestHashing() { |
| 2152 | std::unordered_set<std::shared_ptr<Scalar>, Scalar::Hash, Scalar::PtrsEqual> set; |
nothing calls this directly
no test coverage detected