| 693 | } |
| 694 | |
| 695 | TEST(AdditionalTileDBWriterTest, domain_from_quickinfo) |
| 696 | { |
| 697 | // Set filename for output. |
| 698 | std::string uri = Support::temppath("tiledb_domain_from_quickinfo"); |
| 699 | if (FileUtils::directoryExists(uri)) |
| 700 | FileUtils::deleteDirectory(uri); |
| 701 | |
| 702 | // Create the stage factory. |
| 703 | StageFactory factory; |
| 704 | |
| 705 | // Create faux reader for input data. |
| 706 | Options reader_options; |
| 707 | reader_options.add("filename", Support::datapath("las/autzen_trim.las")); |
| 708 | reader_options.add("count", 0); |
| 709 | Stage* reader = factory.createStage("readers.las"); |
| 710 | reader->setOptions(reader_options); |
| 711 | |
| 712 | Stage* writer = factory.createStage("writers.tiledb"); |
| 713 | Options writer_options; |
| 714 | writer_options.add("filename", uri); |
| 715 | writer->setOptions(writer_options); |
| 716 | writer->setInput(*reader); |
| 717 | |
| 718 | // Execute |
| 719 | PointTable table; |
| 720 | writer->prepare(table); |
| 721 | writer->execute(table); |
| 722 | |
| 723 | // Check schema is created |
| 724 | { |
| 725 | tiledb::Context ctx{}; |
| 726 | tiledb::ArraySchema schema(ctx, uri); |
| 727 | auto domain = schema.domain(); |
| 728 | EXPECT_EQ(domain.ndim(), 3); |
| 729 | tiledb::FilterList fl = |
| 730 | schema.domain().dimension("X").filter_list(); |
| 731 | |
| 732 | tiledb::Array array(ctx, uri, TILEDB_READ); |
| 733 | tiledb::Query q(ctx, array, TILEDB_READ); |
| 734 | |
| 735 | std::vector<double> xs(count); |
| 736 | std::vector<double> ys(count); |
| 737 | std::vector<double> zs(count); |
| 738 | |
| 739 | q.set_data_buffer("X", xs).set_data_buffer("Y", ys).set_data_buffer("Z", |
| 740 | zs); |
| 741 | |
| 742 | q.submit(); |
| 743 | array.close(); |
| 744 | |
| 745 | auto resultNum = (int)q.result_buffer_elements()["X"].second; |
| 746 | EXPECT_EQ(0, resultNum); |
| 747 | |
| 748 | // Check X domain. |
| 749 | std::pair<double, double> x_domain = |
| 750 | domain.dimension(0).domain<double>(); |
| 751 | EXPECT_NEAR(x_domain.first, 636000.76, 0.1); |
| 752 | EXPECT_NEAR(x_domain.second, 637180.21, 0.1); |
nothing calls this directly
no test coverage detected