@@ -121,6 +121,16 @@ class StringRepresentationTypeTest extends AnyFlatSpec with Matchers {
121121 duration.toString should be(" P2M" )
122122 }
123123
124+ it should " return normalized format " in {
125+ ValYearMonthDuration (Period .parse(" P2Y" )).toString should be(" P2Y" )
126+ ValYearMonthDuration (Period .parse(" P24M" )).toString should be(" P2Y" )
127+
128+ ValYearMonthDuration (Period .parse(" P25M" )).toString should be(" P2Y1M" )
129+ ValYearMonthDuration (Period .parse(" P35M" )).toString should be(" P2Y11M" )
130+
131+ ValYearMonthDuration (Period .parse(" P2Y13M" )).toString should be(" P3Y1M" )
132+ }
133+
124134 " A days-time-duration" should " return 'P1DT2H3M4S' " in {
125135 val duration = ValDayTimeDuration (Duration .parse(" P1DT2H3M4S" ))
126136
@@ -151,6 +161,17 @@ class StringRepresentationTypeTest extends AnyFlatSpec with Matchers {
151161 duration.toString should be(" PT4S" )
152162 }
153163
164+ it should " return normalized format " in {
165+ ValDayTimeDuration (Duration .parse(" P5D" )).toString should be(" P5D" )
166+ ValDayTimeDuration (Duration .parse(" PT120H" )).toString should be(" P5D" )
167+ ValDayTimeDuration (Duration .parse(" PT7200M" )).toString should be(" P5D" )
168+ ValDayTimeDuration (Duration .parse(" PT432000S" )).toString should be(" P5D" )
169+
170+ ValDayTimeDuration (Duration .parse(" PT121H" )).toString should be(" P5DT1H" )
171+ ValDayTimeDuration (Duration .parse(" PT7201M" )).toString should be(" P5DT1M" )
172+ ValDayTimeDuration (Duration .parse(" PT7261M" )).toString should be(" P5DT1H1M" )
173+ }
174+
154175 " A list" should " return '[1, 2]' " in {
155176 ValList (List (ValNumber (1 ), ValNumber (2 ))).toString should be(" [1, 2]" )
156177 }
0 commit comments