package Ġio . arc block . wallet kit . utils Ċ Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ import Ġjava . math . BigDecimal Ċ Ċ class ĠNumber UtilsTest Ġ{ ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Token Number Display () Ġ{ ĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* Ġtoken Ġ å±ķç¤º æµĭè¯ķ çĶ¨ ä¾ĭ ĊĠĠĠĠ Ġ* Ġ è§ĦåĪĻ : ĊĠĠĠĠ Ġ* Ġ 1 . Ġ ä¿ĿçķĻ ĠMin ( decimals , Ġ 6 ) Ġ ä½į å°ı æķ° ï¼Į çĽ´æİ¥ æĪª æĸŃ ï¼Į ä¸į åģļ åĽĽ èĪ į äºĶ åħ¥ ĊĠĠĠĠ Ġ* Ġ 2 . Ġ æľ« ä½į çļĦ Ġ 0 Ġ åģļ æĪª åıĸ ĊĠĠĠĠ Ġ*/ ĊĠĠĠ ĠAssert . assertEquals (" 0 ", ĠArc Number Utils . format Number For Token Display (" abcd ", Ġ 1 8 )) ĊĊĠĠĠ ĠAssert . assertEquals (" 1 . 1 2 3 4 5 6 ", ĠArc Number Utils . format Number For Token Display (" 1 1 2 3 4 5 6 7 8 9 0 0 0 0 0 0 0 0 0 ", Ġ 1 8 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 . 1 2 3 4 ", ĠArc Number Utils . format Number For Token Display (" 1 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ", Ġ 1 8 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 ", ĠArc Number Utils . format Number For Token Display (" 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ", Ġ 1 8 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 , 0 0 0 ", ĠArc Number Utils . format Number For Token Display (" 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ", Ġ 1 8 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 . 2 3 4 5 6 ", ĠArc Number Utils . format Number For Token Display (" 1 2 3 4 5 6 ", Ġ 5 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 , 0 0 0 . 2 3 4 5 6 ", ĠArc Number Utils . format Number For Token Display (" 1 0 0 0 2 3 4 5 6 ", Ġ 5 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 , 0 0 0 . 2 3 4 5 ", ĠArc Number Utils . format Number For Token Display (" 1 0 0 0 2 3 4 5 0 ", Ġ 5 )) ĊĠĠĠ ĠAssert . assertEquals (" 0 ", ĠArc Number Utils . format Number For Token Display ("", Ġ 5 )) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Fi at Number Display () Ġ{ ĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* Ġ æ³ķ å¸ģ æķ°åŃĹ å±ķç¤º æµĭè¯ķ çĶ¨ ä¾ĭ ĊĠĠĠĠ Ġ* Ġ è§ĦåĪĻ : ĊĠĠĠĠ Ġ* Ġ 1 . Ġ ä¿ĿçķĻ Ġ 2 Ġ ä½į å°ı æķ° ï¼Į çĽ´æİ¥ æĪª æĸŃ ï¼Į ä¸į åģļ åĽĽ èĪ į äºĶ åħ¥ ĊĠĠĠĠ Ġ* Ġ 2 . Ġ æľ« ä½į çļĦ Ġ 0 Ġ ä¿ĿçķĻ ĊĠĠĠĠ Ġ*/ ĊĠĠĠ ĠAssert . assertEquals (" 0 . 0 0 ", ĠArc Number Utils . format Number For Fi at Display (" acb ")) ĊĊĠĠĠ ĠAssert . assertEquals (" 1 2 . 0 0 ", ĠArc Number Utils . format Number For Fi at Display (" 1 2 ")) ĊĠĠĠ ĠAssert . assertEquals (" 1 2 . 1 2 ", ĠArc Number Utils . format Number For Fi at Display (" 1 2 . 1 2 3 4 5 ")) ĊĠĠĠ ĠAssert . assertEquals (" 1 2 . 9 9 ", ĠArc Number Utils . format Number For Fi at Display (" 1 2 . 9 9 9 9 9 ")) ĊĠĠĠ ĠAssert . assertEquals (" 0 . 0 0 ", ĠArc Number Utils . format Number For Fi at Display (" 0 ")) ĊĠĠĠ ĠAssert . assertEquals (" 0 . 0 9 ", ĠArc Number Utils . format Number For Fi at Display (" 0 . 0 9 9 9 ")) ĊĠĠĠ ĠAssert . assertEquals (" 0 . 0 0 ", ĠArc Number Utils . format Number For Fi at Display ("")) ĊĠ Ġ} ĊĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest String 2 Num (){ ĊĠĠĠ ĠAssert . assertEquals ( ĊĠĠĠĠĠ Ġ" 1 . 2 3 4 5 6 7 8 9 0 1 ". to BigDecimal (), ĊĠĠĠĠĠ ĠArc Number Utils . string 2 BigDecimal With Out Scale (" 1 2 3 4 5 6 7 8 9 0 1 ", Ġ 1 0 )) ĊĊĠĠĠ ĠAssert . assertEquals ( ĊĠĠĠĠĠ Ġ" 1 . 2 3 4 5 6 7 8 9 0 1 ". to BigDecimal (), ĊĠĠĠĠĠ ĠArc Number Utils . string 2 BigDecimal With Out Scale (" 1 2 3 4 5 6 7 8 9 0 1 ". to BigInteger (), Ġ 1 0 )) ĊĊĠĠĠ ĠAssert . assertEquals ( 1 2 3 , ĠArc Number Utils . string 2 Int (" 1 2 3 ")) ĊĠĠĠ ĠAssert . assertEquals (" 1 2 3 ". to BigDecimal (), ĠArc Number Utils . string To BigDecimal (" 1 2 3 ")) ĊĠĠĠ ĠAssert . assertEquals (" 1 . 1 2 3 4 5 6 ", ĠArc Number Utils . format Number For Send (" 1 1 2 3 4 5 6 7 8 9 ", Ġ 9 )) ĊĊĠĠĠ ĠAssert . assertEquals (" 1 . 1 2 3 4 5 6 ", ĠArc Number Utils . format Number For Send (" 1 1 2 3 4 5 6 7 8 9 ". to BigDecimal (), Ġ 9 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 , 1 2 3 . 4 5 6 7 8 9 ", ĠArc Number Utils . format Number For Token Display (" 1 1 2 3 4 5 6 7 8 9 0 0 1 ", Ġ 9 )) ĊĠĠĠ ĠAssert . assertEquals (" 1 . 1 2 ", ĠArc Number Utils . format Number For Token Display (" 1 1 2 0 0 0 0 0 0 0 ". to BigInteger (), Ġ 9 )) ĊĠĠĠ ĠAssert . assertEquals (" 0 ", ĠArc Number Utils . format Number For Token Display (" 0 ". to BigInteger (), Ġ 9 )) ĊĊĊĠĠĠ ĠAssert . assertTrue ( Arc Number Utils . check Can Parse StringTo BigDecimal (" 1 . 1 1 ")) ĊĠĠĠ ĠAssert . assertTrue (! Arc Number Utils . check Can Parse StringTo BigDecimal (" 1 . 1 1 . 1 1 ")) ĊĊĊĠĠĠ ĠAssert . assertTrue ( Arc Number Utils . check Can Parse String ToInt (" 1 1 1 ")) ĊĠĠĠ ĠAssert . assertTrue (! Arc Number Utils . check Can Parse String ToInt (" 1 1 . 1 ")) ĊĊĠĠĠ ĠAssert . assertTrue ( Arc Number Utils . string To BigDecimal ( null ) Ġ== ĠBigDecimal . ZERO ) ĊĠĠĠ ĠAssert . assertTrue ( Arc Number Utils . string To BigDecimal (" abc ") Ġ== ĠBigDecimal . ZERO ) ĊĠĠĠ Ġprintln ( Arc Number Utils . unsigned ("- 1 0 0 0 0 ". to BigInteger ()). toString ()) ĊĠ Ġ} Ċ Ċ } Ċ