@@ -149,6 +149,201 @@ describe('RustConstrainer', () => {
149149 } ) ;
150150 expect ( type ) . toEqual ( 'i64' ) ;
151151 } ) ;
152+ test ( 'should render u8 when format is u8' , ( ) => {
153+ const model = new ConstrainedIntegerModel (
154+ 'test' ,
155+ { } ,
156+ { format : 'u8' } ,
157+ ''
158+ ) ;
159+ const type = RustDefaultTypeMapping . Integer ( {
160+ constrainedModel : model ,
161+ ...defaultOptions
162+ } ) ;
163+ expect ( type ) . toEqual ( 'u8' ) ;
164+ } ) ;
165+
166+ test ( 'should render u16 when format is u16' , ( ) => {
167+ const model = new ConstrainedIntegerModel (
168+ 'test' ,
169+ { } ,
170+ { format : 'u16' } ,
171+ ''
172+ ) ;
173+ const type = RustDefaultTypeMapping . Integer ( {
174+ constrainedModel : model ,
175+ ...defaultOptions
176+ } ) ;
177+ expect ( type ) . toEqual ( 'u16' ) ;
178+ } ) ;
179+
180+ test ( 'should render u32 when format is u32' , ( ) => {
181+ const model = new ConstrainedIntegerModel (
182+ 'test' ,
183+ { } ,
184+ { format : 'u32' } ,
185+ ''
186+ ) ;
187+ const type = RustDefaultTypeMapping . Integer ( {
188+ constrainedModel : model ,
189+ ...defaultOptions
190+ } ) ;
191+ expect ( type ) . toEqual ( 'u32' ) ;
192+ } ) ;
193+
194+ test ( 'should render u64 when format is u64' , ( ) => {
195+ const model = new ConstrainedIntegerModel (
196+ 'test' ,
197+ { } ,
198+ { format : 'u64' } ,
199+ ''
200+ ) ;
201+ const type = RustDefaultTypeMapping . Integer ( {
202+ constrainedModel : model ,
203+ ...defaultOptions
204+ } ) ;
205+ expect ( type ) . toEqual ( 'u64' ) ;
206+ } ) ;
207+
208+ test ( 'should render u128 when format is u128' , ( ) => {
209+ const model = new ConstrainedIntegerModel (
210+ 'test' ,
211+ { } ,
212+ { format : 'u128' } ,
213+ ''
214+ ) ;
215+ const type = RustDefaultTypeMapping . Integer ( {
216+ constrainedModel : model ,
217+ ...defaultOptions
218+ } ) ;
219+ expect ( type ) . toEqual ( 'u128' ) ;
220+ } ) ;
221+
222+ test ( 'should render uint32 format as u32' , ( ) => {
223+ const model = new ConstrainedIntegerModel (
224+ 'test' ,
225+ { } ,
226+ { format : 'uint32' } ,
227+ ''
228+ ) ;
229+ const type = RustDefaultTypeMapping . Integer ( {
230+ constrainedModel : model ,
231+ ...defaultOptions
232+ } ) ;
233+ expect ( type ) . toEqual ( 'u32' ) ;
234+ } ) ;
235+
236+ test ( 'should render uint64 format as u64' , ( ) => {
237+ const model = new ConstrainedIntegerModel (
238+ 'test' ,
239+ { } ,
240+ { format : 'uint64' } ,
241+ ''
242+ ) ;
243+ const type = RustDefaultTypeMapping . Integer ( {
244+ constrainedModel : model ,
245+ ...defaultOptions
246+ } ) ;
247+ expect ( type ) . toEqual ( 'u64' ) ;
248+ } ) ;
249+
250+ test ( 'should render i8 when format is int8' , ( ) => {
251+ const model = new ConstrainedIntegerModel (
252+ 'test' ,
253+ { } ,
254+ { format : 'int8' } ,
255+ ''
256+ ) ;
257+ const type = RustDefaultTypeMapping . Integer ( {
258+ constrainedModel : model ,
259+ ...defaultOptions
260+ } ) ;
261+ expect ( type ) . toEqual ( 'i8' ) ;
262+ } ) ;
263+
264+ test ( 'should render i16 when format is int16' , ( ) => {
265+ const model = new ConstrainedIntegerModel (
266+ 'test' ,
267+ { } ,
268+ { format : 'int16' } ,
269+ ''
270+ ) ;
271+ const type = RustDefaultTypeMapping . Integer ( {
272+ constrainedModel : model ,
273+ ...defaultOptions
274+ } ) ;
275+ expect ( type ) . toEqual ( 'i16' ) ;
276+ } ) ;
277+
278+ test ( 'should render i128 when format is int128' , ( ) => {
279+ const model = new ConstrainedIntegerModel (
280+ 'test' ,
281+ { } ,
282+ { format : 'int128' } ,
283+ ''
284+ ) ;
285+ const type = RustDefaultTypeMapping . Integer ( {
286+ constrainedModel : model ,
287+ ...defaultOptions
288+ } ) ;
289+ expect ( type ) . toEqual ( 'i128' ) ;
290+ } ) ;
291+
292+ test ( 'should render u8 when format is uint8' , ( ) => {
293+ const model = new ConstrainedIntegerModel (
294+ 'test' ,
295+ { } ,
296+ { format : 'uint8' } ,
297+ ''
298+ ) ;
299+ const type = RustDefaultTypeMapping . Integer ( {
300+ constrainedModel : model ,
301+ ...defaultOptions
302+ } ) ;
303+ expect ( type ) . toEqual ( 'u8' ) ;
304+ } ) ;
305+
306+ test ( 'should render u16 when format is uint16' , ( ) => {
307+ const model = new ConstrainedIntegerModel (
308+ 'test' ,
309+ { } ,
310+ { format : 'uint16' } ,
311+ ''
312+ ) ;
313+ const type = RustDefaultTypeMapping . Integer ( {
314+ constrainedModel : model ,
315+ ...defaultOptions
316+ } ) ;
317+ expect ( type ) . toEqual ( 'u16' ) ;
318+ } ) ;
319+
320+ test ( 'should render u128 when format is uint128' , ( ) => {
321+ const model = new ConstrainedIntegerModel (
322+ 'test' ,
323+ { } ,
324+ { format : 'uint128' } ,
325+ ''
326+ ) ;
327+ const type = RustDefaultTypeMapping . Integer ( {
328+ constrainedModel : model ,
329+ ...defaultOptions
330+ } ) ;
331+ expect ( type ) . toEqual ( 'u128' ) ;
332+ } ) ;
333+
334+ test ( 'should render default i32 when format is unknown' , ( ) => {
335+ const model = new ConstrainedIntegerModel (
336+ 'test' ,
337+ { } ,
338+ { format : 'unknown' } ,
339+ ''
340+ ) ;
341+ const type = RustDefaultTypeMapping . Integer ( {
342+ constrainedModel : model ,
343+ ...defaultOptions
344+ } ) ;
345+ expect ( type ) . toEqual ( 'i32' ) ;
346+ } ) ;
152347 } ) ;
153348 describe ( 'String' , ( ) => {
154349 test ( 'should render type' , ( ) => {
0 commit comments