| 965 | } |
| 966 | |
| 967 | void test() |
| 968 | { |
| 969 | geode::OpenGeodeModelLibrary::initialize(); |
| 970 | geode::Logger::set_level( geode::Logger::LEVEL::debug ); |
| 971 | geode::Section model; |
| 972 | geode::SectionBuilder builder( model ); |
| 973 | |
| 974 | // This Section represents a house (with one triangle and one square as |
| 975 | // in children sketches) |
| 976 | const auto corner_uuids = add_corners( model, builder ); |
| 977 | const auto line_uuids = add_lines( model, builder ); |
| 978 | const auto surface_uuids = add_surfaces( model, builder ); |
| 979 | const auto model_boundary_uuids = add_model_boundaries( model, builder ); |
| 980 | const auto corner_collection_uuids = |
| 981 | add_corner_collections( model, builder ); |
| 982 | const auto line_collection_uuids = add_line_collections( model, builder ); |
| 983 | const auto surface_collection_uuids = |
| 984 | add_surface_collections( model, builder ); |
| 985 | |
| 986 | test_registry( model ); |
| 987 | |
| 988 | set_geometry( builder, corner_uuids, line_uuids, surface_uuids ); |
| 989 | |
| 990 | add_corner_line_boundary_relation( |
| 991 | model, builder, corner_uuids, line_uuids ); |
| 992 | add_line_surface_boundary_relation( |
| 993 | model, builder, line_uuids, surface_uuids ); |
| 994 | add_lines_in_model_boundaries( |
| 995 | model, builder, line_uuids, model_boundary_uuids ); |
| 996 | add_corners_in_corner_collections( |
| 997 | model, builder, corner_uuids, corner_collection_uuids ); |
| 998 | add_lines_in_line_collections( |
| 999 | model, builder, line_uuids, line_collection_uuids ); |
| 1000 | add_surfaces_in_surface_collections( |
| 1001 | model, builder, surface_uuids, surface_collection_uuids ); |
| 1002 | add_internal_corner_relations( |
| 1003 | model, builder, corner_uuids, surface_uuids ); |
| 1004 | add_internal_line_relations( model, builder, line_uuids, surface_uuids ); |
| 1005 | geode::OpenGeodeModelException::test( |
| 1006 | model.nb_internals( surface_uuids[0] ) == corner_uuids.size() + 3, |
| 1007 | "The Surface should embed all Corners & Lines (that are " |
| 1008 | "internal to the Surface)" ); |
| 1009 | test_boundary_ranges( model, corner_uuids, line_uuids, surface_uuids ); |
| 1010 | test_incidence_ranges( model, corner_uuids, line_uuids, surface_uuids ); |
| 1011 | test_item_ranges( model, line_uuids, model_boundary_uuids ); |
| 1012 | test_corner_collections_ranges( |
| 1013 | model, corner_uuids, corner_collection_uuids ); |
| 1014 | test_line_collections_ranges( model, line_uuids, line_collection_uuids ); |
| 1015 | test_surface_collections_ranges( |
| 1016 | model, surface_uuids, surface_collection_uuids ); |
| 1017 | test_clone( model ); |
| 1018 | |
| 1019 | const auto file_io = absl::StrCat( "test.", model.native_extension() ); |
| 1020 | geode::save_section( model, file_io ); |
| 1021 | |
| 1022 | auto model2 = geode::load_section( file_io ); |
| 1023 | test_compare_section( model, model2 ); |
| 1024 |
no test coverage detected