@@ -54,13 +54,13 @@ mod unit {
5454
5555 #[test]
5656 fn test_data_declaration() {
57- // Implicit data_type is not allowed unless the `var` keyword is used.
58- test!(data_declaration, "logic x = 0;", Ok((_, _)));
59- test!(data_declaration, " x = 0;", Err(_));
60- test!(data_declaration, "var logic x = 0;", Ok((_, _)));
61- test!(data_declaration, "var x = 0;", Ok((_, _)));
62- test!(data_declaration, "const logic x = 0;", Ok((_, _)));
63- test!(data_declaration, "const x = 0;", Err(_));
57+ // Implicit data_type is not allowed unless the `var` keyword is used.
58+ test!(data_declaration, "logic x = 0;", Ok((_, _)));
59+ test!(data_declaration, " x = 0;", Err(_));
60+ test!(data_declaration, "var logic x = 0;", Ok((_, _)));
61+ test!(data_declaration, "var x = 0;", Ok((_, _)));
62+ test!(data_declaration, "const logic x = 0;", Ok((_, _)));
63+ test!(data_declaration, "const x = 0;", Err(_));
6464 }
6565
6666 #[test]
@@ -332,6 +332,14 @@ mod unit {
332332 test!(expression, "(!a ? 0 : !b : 1 : c ? 0 : 1)", Ok((_, _)));
333333 }
334334
335+ #[test]
336+ fn test_bin_op_expression() {
337+ test!(expression, "type(logic) == type(logic)", Ok((_, _)));
338+ test!(expression, "type(logic) != type(logic)", Ok((_, _)));
339+ test!(expression, "type(logic) + type(logic)", Err(_));
340+ test!(expression, "type(logic) == a", Err(_));
341+ }
342+
335343 #[test]
336344 fn test_text_macro_definition() {
337345 test!(text_macro_definition, r##"`define a b c"##, Ok((_, _)));
@@ -809,11 +817,7 @@ mod spec {
809817 r##"a = add (* mode = "cla" *) (b, c);"##,
810818 Ok((_, _))
811819 );
812- test!(
813- statement,
814- r##"a = b ? (* no_glitch *) c : d;"##,
815- Ok((_, _))
816- );
820+ test!(statement, r##"a = b ? (* no_glitch *) c : d;"##, Ok((_, _)));
817821 }
818822
819823 #[test]
@@ -2685,11 +2689,7 @@ mod spec {
26852689 status = p.current_status();"##,
26862690 Ok((_, _))
26872691 );
2688- test!(
2689- statement,
2690- r##"status = current_status(p);"##,
2691- Ok((_, _))
2692- );
2692+ test!(statement, r##"status = current_status(p);"##, Ok((_, _)));
26932693 test!(many1(module_item), r##"Packet p = new;"##, Ok((_, _)));
26942694 test!(
26952695 many1(module_item),
@@ -3512,11 +3512,7 @@ mod spec {
35123512 end"##,
35133513 Ok((_, _))
35143514 );
3515- test!(
3516- statement,
3517- r##"put_ref = new(); // illegal"##,
3518- Ok((_, _))
3519- );
3515+ test!(statement, r##"put_ref = new(); // illegal"##, Ok((_, _)));
35203516 test!(
35213517 many1(module_item),
35223518 r##"interface class IntfBase1;
@@ -15942,6 +15938,35 @@ mod spec {
1594215938 Ok((_, _))
1594315939 );
1594415940 }
15941+
15942+ #[test]
15943+ fn test_case_statement_comparison() {
15944+ test!(
15945+ many1(case_statement),
15946+ r##"case (type(logic))
15947+ type(logic[11:0]) : ;
15948+ type(logic) : ;
15949+ default : ;
15950+ endcase"##,
15951+ Ok((_, _))
15952+ );
15953+ test!(
15954+ many1(case_statement),
15955+ r##"case (type(logic))
15956+ 1 : ;
15957+ default : ;
15958+ endcase"##,
15959+ Err(_)
15960+ );
15961+ test!(
15962+ many1(case_statement),
15963+ r##"case (type(logic))
15964+ x : ;
15965+ default : ;
15966+ endcase"##,
15967+ Err(_)
15968+ );
15969+ }
1594515970}
1594615971
1594715972mod error {
0 commit comments