| 97 | }; |
| 98 | |
| 99 | TEST_F(MockDatasetFactoryTest, UnifySchemas) { |
| 100 | MakeFactory({}); |
| 101 | AssertInspect(schema({})); |
| 102 | |
| 103 | MakeFactory({schema({i32}), schema({i32})}); |
| 104 | AssertInspect(schema({i32})); |
| 105 | |
| 106 | MakeFactory({schema({i32}), schema({i64})}); |
| 107 | AssertInspect(schema({i32, i64})); |
| 108 | |
| 109 | MakeFactory({schema({i32}), schema({i64})}); |
| 110 | AssertInspect(schema({i32, i64})); |
| 111 | |
| 112 | MakeFactory({schema({i32}), schema({i32_req})}); |
| 113 | AssertInspect(schema({i32})); |
| 114 | |
| 115 | MakeFactory({schema({i32, f64}), schema({i32_req, i64})}); |
| 116 | AssertInspect(schema({i32, f64, i64})); |
| 117 | |
| 118 | MakeFactory({schema({i32, f64}), schema({f64, i32_fake})}); |
| 119 | // Unification fails when fields with the same name have clashing types. |
| 120 | ASSERT_RAISES(TypeError, factory_->Inspect()); |
| 121 | // Return the individual schema for closer inspection should not fail. |
| 122 | AssertInspectSchemas({schema({i32, f64}), schema({f64, i32_fake})}); |
| 123 | |
| 124 | MakeFactory({schema({field("num", int32())}), schema({field("num", float64())})}); |
| 125 | ASSERT_RAISES(TypeError, factory_->Inspect()); |
| 126 | InspectOptions permissive_options; |
| 127 | permissive_options.field_merge_options = Field::MergeOptions::Permissive(); |
| 128 | AssertInspect(schema({field("num", float64())}), permissive_options); |
| 129 | } |
| 130 | |
| 131 | class FileSystemDatasetFactoryTest : public DatasetFactoryTest { |
| 132 | public: |
nothing calls this directly
no test coverage detected