@@ -16,8 +16,14 @@ fn decode_encode() {
16
16
<dimIndex>10,20</dimIndex>
17
17
</dimElement>
18
18
" ,
19
+ "<dimElement>
20
+ <dim>2</dim>
21
+ <dimIncrement>0x4</dimIncrement>
22
+ <dimIndex>10,20</dimIndex>
23
+ </dimElement>
24
+ " ,
19
25
) ] ;
20
- run_test :: < DimElement > ( & tests[ ..] ) ;
26
+ run_test :: < DimElement > ( & tests[ ..] , None , None ) ;
21
27
22
28
let tests = vec ! [ (
23
29
DimElement :: builder( )
@@ -36,8 +42,14 @@ fn decode_encode() {
36
42
<dimIndex>3-5</dimIndex>
37
43
</dimElement>
38
44
" ,
45
+ "<dimElement>
46
+ <dim>3</dim>
47
+ <dimIncrement>0x4</dimIncrement>
48
+ <dimIndex>3-5</dimIndex>
49
+ </dimElement>
50
+ " ,
39
51
) ] ;
40
- run_test :: < DimElement > ( & tests[ ..] ) ;
52
+ run_test :: < DimElement > ( & tests[ ..] , None , None ) ;
41
53
42
54
let tests = vec ! [ (
43
55
DimElement :: builder( )
@@ -56,8 +68,14 @@ fn decode_encode() {
56
68
<dimIndex>3,5,4</dimIndex>
57
69
</dimElement>
58
70
" ,
71
+ "<dimElement>
72
+ <dim>3</dim>
73
+ <dimIncrement>0x4</dimIncrement>
74
+ <dimIndex>3,5,4</dimIndex>
75
+ </dimElement>
76
+ " ,
59
77
) ] ;
60
- run_test :: < DimElement > ( & tests[ ..] ) ;
78
+ run_test :: < DimElement > ( & tests[ ..] , None , None ) ;
61
79
62
80
let tests = vec ! [ (
63
81
DimElement :: builder( )
@@ -72,8 +90,39 @@ fn decode_encode() {
72
90
<dimIndex>3-3</dimIndex>
73
91
</dimElement>
74
92
" ,
93
+ "<dimElement>
94
+ <dim>1</dim>
95
+ <dimIncrement>0x0</dimIncrement>
96
+ <dimIndex>3-3</dimIndex>
97
+ </dimElement>
98
+ " ,
75
99
) ] ;
76
- run_test :: < DimElement > ( & tests[ ..] ) ;
100
+ run_test :: < DimElement > ( & tests[ ..] , None , None ) ;
101
+
102
+ let parse_config = svd_parser:: Config :: default ( ) ;
103
+ let mut encode_config = svd_encoder:: Config :: default ( ) ;
104
+ encode_config. update ( "dim_dim" , "UpperHex" ) ;
105
+ encode_config. update ( "dim_increment" , "LowerHex" ) ;
106
+
107
+ let tests = vec ! [ (
108
+ DimElement :: builder( )
109
+ . dim( 14 )
110
+ . dim_increment( 15 )
111
+ . build( ValidateLevel :: Strict )
112
+ . unwrap( ) ,
113
+ "<dimElement>
114
+ <dim>14</dim>
115
+ <dimIncrement>0xF</dimIncrement>
116
+ </dimElement>
117
+ " ,
118
+ "<dimElement>
119
+ <dim>0xE</dim>
120
+ <dimIncrement>0xf</dimIncrement>
121
+ </dimElement>
122
+ " ,
123
+ ) ] ;
124
+
125
+ run_test :: < DimElement > ( & tests[ ..] , Some ( parse_config) , Some ( encode_config) ) ;
77
126
}
78
127
79
128
#[ test]
0 commit comments