| 829 | }; |
| 830 | |
| 831 | TEST_F(TestCDC, ChunkSizeParameterValidation) { |
| 832 | // Test that constructor validates min/max chunk size parameters |
| 833 | auto li = LevelInfo(); |
| 834 | |
| 835 | ASSERT_NO_THROW(ContentDefinedChunker(li, 256 * 1024, 1024 * 1024)); |
| 836 | |
| 837 | // with norm_level=0 the difference between min and max chunk size must be |
| 838 | // at least 16 |
| 839 | ASSERT_THROW(ContentDefinedChunker(li, 0, -1), ParquetException); |
| 840 | ASSERT_THROW(ContentDefinedChunker(li, 1024, 512), ParquetException); |
| 841 | |
| 842 | ASSERT_THROW(ContentDefinedChunker(li, -1, 0), ParquetException); |
| 843 | ASSERT_THROW(ContentDefinedChunker(li, 0, 0), ParquetException); |
| 844 | ASSERT_THROW(ContentDefinedChunker(li, 0, 16), ParquetException); |
| 845 | ASSERT_NO_THROW(ContentDefinedChunker(li, 0, 32)); |
| 846 | ASSERT_THROW(ContentDefinedChunker(li, -16, -16), ParquetException); |
| 847 | ASSERT_THROW(ContentDefinedChunker(li, 16, 0), ParquetException); |
| 848 | ASSERT_THROW(ContentDefinedChunker(li, 32, 32), ParquetException); |
| 849 | ASSERT_THROW(ContentDefinedChunker(li, 32, 48), ParquetException); |
| 850 | ASSERT_NO_THROW(ContentDefinedChunker(li, 32, 64)); |
| 851 | ASSERT_NO_THROW(ContentDefinedChunker(li, 1024 * 1024, 2 * 1024 * 1024)); |
| 852 | ASSERT_NO_THROW( |
| 853 | ContentDefinedChunker(li, 1024 * 1024 * 1024L, 2LL * 1024 * 1024 * 1024L)); |
| 854 | |
| 855 | // with norm_level=1 the difference between min and max chunk size must be |
| 856 | // at least 64 |
| 857 | ASSERT_THROW(ContentDefinedChunker(li, 1, -1, 1), ParquetException); |
| 858 | ASSERT_THROW(ContentDefinedChunker(li, -1, 1, 1), ParquetException); |
| 859 | ASSERT_THROW(ContentDefinedChunker(li, 1, 1, 1), ParquetException); |
| 860 | ASSERT_THROW(ContentDefinedChunker(li, 1, 32, 1), ParquetException); |
| 861 | ASSERT_THROW(ContentDefinedChunker(li, 1, 33, 1), ParquetException); |
| 862 | ASSERT_NO_THROW(ContentDefinedChunker(li, 1, 65, 1)); |
| 863 | |
| 864 | // with norm_level=2 the difference between min and max chunk size must be |
| 865 | // at least 128 |
| 866 | ASSERT_THROW(ContentDefinedChunker(li, 0, 123, 2), ParquetException); |
| 867 | ASSERT_NO_THROW(ContentDefinedChunker(li, 0, 128, 2)); |
| 868 | } |
| 869 | |
| 870 | TEST_F(TestCDC, RollingHashMaskCalculation) { |
| 871 | auto le = LevelInfo(); |
nothing calls this directly
no test coverage detected