| 49 | class GenericWriterTest : public functions::test::FunctionBaseTest {}; |
| 50 | |
| 51 | TEST_F(GenericWriterTest, boolean) { |
| 52 | VectorPtr result; |
| 53 | BaseVector::ensureWritable(SelectivityVector(5), BOOLEAN(), pool(), result); |
| 54 | |
| 55 | VectorWriter<Any> writer; |
| 56 | writer.init(*result); |
| 57 | |
| 58 | for (int i = 0; i < 5; ++i) { |
| 59 | writer.setOffset(i); |
| 60 | |
| 61 | auto& current = writer.current(); |
| 62 | current.castTo<bool>() = i % 2; |
| 63 | |
| 64 | writer.commit(true); |
| 65 | } |
| 66 | writer.finish(); |
| 67 | test::assertEqualVectors( |
| 68 | makeFlatVector<bool>({false, true, false, true, false}), result); |
| 69 | |
| 70 | writer.setOffset(0); |
| 71 | auto& current = writer.current(); |
| 72 | |
| 73 | ASSERT_NO_THROW(current.tryCastTo<int32_t>()); |
| 74 | ASSERT_TRUE(current.tryCastTo<int32_t>() == nullptr); |
| 75 | } |
| 76 | |
| 77 | TEST_F(GenericWriterTest, integer) { |
| 78 | VectorPtr result; |
nothing calls this directly
no test coverage detected