@@ -521,57 +521,80 @@ mod tests {
521
521
assert ! ( !outgoing[ 0 ] . is_change_state( ) ) ;
522
522
}
523
523
524
- // use indoc::indoc;
525
- // const SMCAT_STATIC: &str = indoc! {r#"
526
- // initial,
527
- // Init,
528
- // Foo,
529
- // Bar;
530
- // initial => Init;
531
- // Init -> Foo : " Init:> ";
532
- // Foo -> Bar : " next "; Bar -> Foo [color="grey"] : " next ";
533
- // "#};
534
- // const SMCAT_LIVE_1: &str = indoc! {r#"
535
- // initial,
536
- // Init,
537
- // Foo [active color="red"],
538
- // Bar;
539
- // initial => Init;
540
- // Init -> Foo [color="red" width=2] : " Init:> ";
541
- // Foo -> Bar : " next ";
542
- // Bar -> Foo [color="grey"] : " next ";
543
- // "#};
544
- // const SMCAT_LIVE_2: &str = indoc! {r#"
545
- // initial,
546
- // Init,
547
- // Foo,
548
- // Bar [active color="red"];
549
- // initial => Init;
550
- // Init -> Foo : " Init:> ";
551
- // Foo -> Bar [color="red" width=2] : " next ";
552
- // Bar -> Foo [color="grey"] : " next ";
553
- // "#};
554
- // const SMCAT_LIVE_3: &str = indoc! {r#"
555
- // initial,
556
- // Init,
557
- // Foo [active color="red"],
558
- // Bar;
559
- // initial => Init;
560
- // Init -> Foo : " Init:> ";
561
- // Foo -> Bar : " next ";
562
- // Bar -> Foo [color="pink" width=2] : " next ";
563
- // "#};
564
- //
565
- // #[test]
566
- // fn smcat_renderer() {
567
- // let smcat = smcat::Renderer::new(Box::new(smcat::SimpleStyle));
568
- // assert_eq!(smcat.render_static(info::machine()), SMCAT_STATIC);
569
- //
570
- // let mut sm = unsync::Demo::new();
571
- // assert_eq!(smcat.render_live(&sm), SMCAT_LIVE_1);
572
- // sm.next();
573
- // assert_eq!(smcat.render_live(&sm), SMCAT_LIVE_2);
574
- // sm.next();
575
- // assert_eq!(smcat.render_live(&sm), SMCAT_LIVE_3);
576
- // }
524
+ use indoc:: indoc;
525
+ const SMCAT_STATIC : & str = indoc ! { r#"
526
+ initial,
527
+ Init,
528
+ Foo,
529
+ Bar;
530
+ initial => Init;
531
+ Init -> Foo : " Init:> ";
532
+ Foo -> Bar : " next ";
533
+ Bar -> Foo [color="grey"] : " next ";
534
+ "# } ;
535
+ const SMCAT_LIVE_1 : & str = indoc ! { r#"
536
+ initial,
537
+ Init,
538
+ Foo [active color="red"],
539
+ Bar;
540
+ initial => Init;
541
+ Init -> Foo [color="red" width=2] : " Init:> ";
542
+ Foo -> Bar : " next ";
543
+ Bar -> Foo [color="grey"] : " next ";
544
+ "# } ;
545
+ const SMCAT_LIVE_2 : & str = indoc ! { r#"
546
+ initial,
547
+ Init,
548
+ Foo,
549
+ Bar [active color="red"];
550
+ initial => Init;
551
+ Init -> Foo : " Init:> ";
552
+ Foo -> Bar [color="red" width=2] : " next ";
553
+ Bar -> Foo [color="grey"] : " next ";
554
+ "# } ;
555
+ const SMCAT_LIVE_3 : & str = indoc ! { r#"
556
+ initial,
557
+ Init,
558
+ Foo [active color="red"],
559
+ Bar;
560
+ initial => Init;
561
+ Init -> Foo : " Init:> ";
562
+ Foo -> Bar : " next ";
563
+ Bar -> Foo [color="pink" width=2] : " next ";
564
+ "# } ;
565
+
566
+ #[ test]
567
+ fn smcat_render_static ( ) {
568
+ use frame_runtime:: smcat:: * ;
569
+ let smcat = Renderer :: new ( Box :: new ( SimpleStyle ) ) ;
570
+ assert_eq ! ( smcat. render_static( super :: info:: machine( ) ) , SMCAT_STATIC ) ;
571
+ }
572
+
573
+ #[ test]
574
+ fn smcat_render_live_sync ( ) {
575
+ use crate :: demo:: sync:: * ;
576
+ use frame_runtime:: smcat:: sync:: * ;
577
+ let smcat = Renderer :: new ( Box :: new ( SimpleStyle ) ) ;
578
+
579
+ let mut sm = Demo :: new ( ) ;
580
+ assert_eq ! ( smcat. render_live_sync( & sm) , SMCAT_LIVE_1 ) ;
581
+ sm. next ( ) ;
582
+ assert_eq ! ( smcat. render_live_sync( & sm) , SMCAT_LIVE_2 ) ;
583
+ sm. next ( ) ;
584
+ assert_eq ! ( smcat. render_live_sync( & sm) , SMCAT_LIVE_3 ) ;
585
+ }
586
+
587
+ #[ test]
588
+ fn smcat_render_live_unsync ( ) {
589
+ use crate :: demo:: unsync:: * ;
590
+ use frame_runtime:: smcat:: unsync:: * ;
591
+ let smcat = Renderer :: new ( Box :: new ( SimpleStyle ) ) ;
592
+
593
+ let mut sm = Demo :: new ( ) ;
594
+ assert_eq ! ( smcat. render_live_unsync( & sm) , SMCAT_LIVE_1 ) ;
595
+ sm. next ( ) ;
596
+ assert_eq ! ( smcat. render_live_unsync( & sm) , SMCAT_LIVE_2 ) ;
597
+ sm. next ( ) ;
598
+ assert_eq ! ( smcat. render_live_unsync( & sm) , SMCAT_LIVE_3 ) ;
599
+ }
577
600
}
0 commit comments