@@ -483,7 +483,7 @@ TEST(10)
483483 std::string input;
484484 for (size_t i = 0 ; i < sizeof (def_files) / sizeof (def_files[0 ]); ++i) {
485485 if (i > 0 ) {
486- input += " , " ;
486+ input += " + " ;
487487 }
488488 input += def_dir + " /" + def_files[i];
489489 }
@@ -510,3 +510,201 @@ TEST(10)
510510
511511 db::compare_layouts (this , layout, input_au, db::WriteOAS);
512512}
513+
514+ // Merging with +
515+ TEST (11_1)
516+ {
517+ std::string input_dir = tl::testdata ();
518+ input_dir += " /bd" ;
519+
520+ std::string input_au = input_dir + " /strm2oas_au_1.oas" ;
521+ std::string input = input_dir + " /strm2oas_1.oas+" + input_dir + " /strm2oas_2.oas" ;
522+
523+ std::string output = this ->tmp_file (" strm2oas_1.oas" );
524+ const char *argv[] = { " x" ,
525+ " --blend-mode=0" ,
526+ input.c_str (),
527+ output.c_str ()
528+ };
529+
530+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
531+
532+ db::Layout layout;
533+ {
534+ tl::InputStream stream (output);
535+ db::LoadLayoutOptions options;
536+ db::Reader reader (stream);
537+ reader.read (layout, options);
538+ }
539+
540+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
541+ }
542+
543+ // Merging with + not allowed on different DBUs
544+ TEST (11_2)
545+ {
546+ std::string input_dir = tl::testdata ();
547+ input_dir += " /bd" ;
548+
549+ std::string input_au = input_dir + " /strm2oas_au_1.oas" ;
550+ std::string input = input_dir + " /strm2oas_1.oas+" + input_dir + " /strm2oas_2_10nm.oas" ;
551+
552+ std::string output = this ->tmp_file (" strm2oas_1.oas" );
553+ const char *argv[] = { " x" ,
554+ " --blend-mode=0" ,
555+ input.c_str (),
556+ output.c_str ()
557+ };
558+
559+ try {
560+ bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name);
561+ EXPECT_EQ (1 , 0 );
562+ } catch (tl::Exception &ex) {
563+ EXPECT_EQ (ex.msg (), " Former and present database units are not compatible: 0.001 (former) vs. 0.01 (present)" );
564+ }
565+ }
566+
567+ // Merging with + not allowed on different DBUs
568+ TEST (11_3)
569+ {
570+ std::string input_dir = tl::testdata ();
571+ input_dir += " /bd" ;
572+
573+ std::string input_au = input_dir + " /strm2oas_au_3.oas" ;
574+ std::string input = input_dir + " /strm2oas_1.oas," + input_dir + " /strm2oas_2_10nm.oas" ;
575+
576+ std::string output = this ->tmp_file (" strm2oas_3.oas" );
577+ const char *argv[] = { " x" ,
578+ " --blend-mode=0" ,
579+ input.c_str (),
580+ output.c_str ()
581+ };
582+
583+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
584+
585+ db::Layout layout;
586+ {
587+ tl::InputStream stream (output);
588+ db::LoadLayoutOptions options;
589+ db::Reader reader (stream);
590+ reader.read (layout, options);
591+ }
592+
593+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
594+ }
595+
596+ // Merging with + and , under the presence of ghost cells: test+test,top->(test)
597+ TEST (12_1)
598+ {
599+ std::string input_dir = tl::testdata ();
600+ input_dir += " /bd" ;
601+
602+ std::string input_au = input_dir + " /strm2oas_au_12_1.oas" ;
603+ std::string input = input_dir + " /strm2oas_a.oas+" + input_dir + " /strm2oas_b.oas," + input_dir + " /strm2oas_c.oas" ;
604+
605+ std::string output = this ->tmp_file (" strm2oas_12_1.oas" );
606+ const char *argv[] = { " x" ,
607+ " --blend-mode=0" ,
608+ input.c_str (),
609+ output.c_str ()
610+ };
611+
612+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
613+
614+ db::Layout layout;
615+ {
616+ tl::InputStream stream (output);
617+ db::LoadLayoutOptions options;
618+ db::Reader reader (stream);
619+ reader.read (layout, options);
620+ }
621+
622+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
623+ }
624+
625+ // Merging with + and , under the presence of ghost cells: top->(test),test+test
626+ TEST (12_2)
627+ {
628+ std::string input_dir = tl::testdata ();
629+ input_dir += " /bd" ;
630+
631+ std::string input_au = input_dir + " /strm2oas_au_12_2.oas" ;
632+ std::string input = input_dir + " /strm2oas_c.oas," + input_dir + " /strm2oas_a.oas+" + input_dir + " /strm2oas_b.oas" ;
633+
634+ std::string output = this ->tmp_file (" strm2oas_12_2.oas" );
635+ const char *argv[] = { " x" ,
636+ " --blend-mode=0" ,
637+ input.c_str (),
638+ output.c_str ()
639+ };
640+
641+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
642+
643+ db::Layout layout;
644+ {
645+ tl::InputStream stream (output);
646+ db::LoadLayoutOptions options;
647+ db::Reader reader (stream);
648+ reader.read (layout, options);
649+ }
650+
651+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
652+ }
653+
654+ // Merging with + and , under the presence of ghost cells: test+test,toptop->top->(test)
655+ TEST (12_3)
656+ {
657+ std::string input_dir = tl::testdata ();
658+ input_dir += " /bd" ;
659+
660+ std::string input_au = input_dir + " /strm2oas_au_12_3.oas" ;
661+ std::string input = input_dir + " /strm2oas_a.oas+" + input_dir + " /strm2oas_b.oas," + input_dir + " /strm2oas_cc.oas" ;
662+
663+ std::string output = this ->tmp_file (" strm2oas_12_3.oas" );
664+ const char *argv[] = { " x" ,
665+ " --blend-mode=0" ,
666+ input.c_str (),
667+ output.c_str ()
668+ };
669+
670+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
671+
672+ db::Layout layout;
673+ {
674+ tl::InputStream stream (output);
675+ db::LoadLayoutOptions options;
676+ db::Reader reader (stream);
677+ reader.read (layout, options);
678+ }
679+
680+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
681+ }
682+
683+ // Merging with + and , under the presence of ghost cells: toptop->top->(test),test+test
684+ TEST (12_4)
685+ {
686+ std::string input_dir = tl::testdata ();
687+ input_dir += " /bd" ;
688+
689+ std::string input_au = input_dir + " /strm2oas_au_12_4.oas" ;
690+ std::string input = input_dir + " /strm2oas_cc.oas," + input_dir + " /strm2oas_a.oas+" + input_dir + " /strm2oas_b.oas" ;
691+
692+ std::string output = this ->tmp_file (" strm2oas_12_4.oas" );
693+ const char *argv[] = { " x" ,
694+ " --blend-mode=0" ,
695+ input.c_str (),
696+ output.c_str ()
697+ };
698+
699+ EXPECT_EQ (bd::converter_main (sizeof (argv) / sizeof (argv[0 ]), (char **) argv, bd::GenericWriterOptions::oasis_format_name), 0 );
700+
701+ db::Layout layout;
702+ {
703+ tl::InputStream stream (output);
704+ db::LoadLayoutOptions options;
705+ db::Reader reader (stream);
706+ reader.read (layout, options);
707+ }
708+
709+ db::compare_layouts (this , layout, input_au, db::WriteOAS);
710+ }
0 commit comments