OSDN Git Service

new repo
[bytom/vapor.git] / vendor / github.com / go-playground / locales / ru / ru_test.go
1 package ru
2
3 import (
4         "testing"
5         "time"
6
7         "github.com/go-playground/locales"
8         "github.com/go-playground/locales/currency"
9 )
10
11 func TestLocale(t *testing.T) {
12
13         trans := New()
14         expected := "ru"
15
16         if trans.Locale() != expected {
17                 t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
18         }
19 }
20
21 func TestPluralsRange(t *testing.T) {
22
23         trans := New()
24
25         tests := []struct {
26                 expected locales.PluralRule
27         }{
28         // {
29         //      expected: locales.PluralRuleOther,
30         // },
31         }
32
33         rules := trans.PluralsRange()
34         // expected := 1
35         // if len(rules) != expected {
36         //      t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
37         // }
38
39         for _, tt := range tests {
40
41                 r := locales.PluralRuleUnknown
42
43                 for i := 0; i < len(rules); i++ {
44                         if rules[i] == tt.expected {
45                                 r = rules[i]
46                                 break
47                         }
48                 }
49                 if r == locales.PluralRuleUnknown {
50                         t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
51                 }
52         }
53 }
54
55 func TestPluralsOrdinal(t *testing.T) {
56
57         trans := New()
58
59         tests := []struct {
60                 expected locales.PluralRule
61         }{
62         // {
63         //      expected: locales.PluralRuleOne,
64         // },
65         // {
66         //      expected: locales.PluralRuleTwo,
67         // },
68         // {
69         //      expected: locales.PluralRuleFew,
70         // },
71         // {
72         //      expected: locales.PluralRuleOther,
73         // },
74         }
75
76         rules := trans.PluralsOrdinal()
77         // expected := 4
78         // if len(rules) != expected {
79         //      t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
80         // }
81
82         for _, tt := range tests {
83
84                 r := locales.PluralRuleUnknown
85
86                 for i := 0; i < len(rules); i++ {
87                         if rules[i] == tt.expected {
88                                 r = rules[i]
89                                 break
90                         }
91                 }
92                 if r == locales.PluralRuleUnknown {
93                         t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
94                 }
95         }
96 }
97
98 func TestPluralsCardinal(t *testing.T) {
99
100         trans := New()
101
102         tests := []struct {
103                 expected locales.PluralRule
104         }{
105         // {
106         //      expected: locales.PluralRuleOne,
107         // },
108         // {
109         //      expected: locales.PluralRuleOther,
110         // },
111         }
112
113         rules := trans.PluralsCardinal()
114         // expected := 2
115         // if len(rules) != expected {
116         //      t.Errorf("Expected '%d' Got '%d'", expected, len(rules))
117         // }
118
119         for _, tt := range tests {
120
121                 r := locales.PluralRuleUnknown
122
123                 for i := 0; i < len(rules); i++ {
124                         if rules[i] == tt.expected {
125                                 r = rules[i]
126                                 break
127                         }
128                 }
129                 if r == locales.PluralRuleUnknown {
130                         t.Errorf("Expected '%s' Got '%s'", tt.expected, r)
131                 }
132         }
133 }
134
135 func TestRangePlurals(t *testing.T) {
136
137         trans := New()
138
139         tests := []struct {
140                 num1     float64
141                 v1       uint64
142                 num2     float64
143                 v2       uint64
144                 expected locales.PluralRule
145         }{
146         // {
147         //      num1:     1,
148         //      v1:       1,
149         //      num2:     2,
150         //      v2:       2,
151         //      expected: locales.PluralRuleOther,
152         // },
153         }
154
155         for _, tt := range tests {
156                 rule := trans.RangePluralRule(tt.num1, tt.v1, tt.num2, tt.v2)
157                 if rule != tt.expected {
158                         t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
159                 }
160         }
161 }
162
163 func TestOrdinalPlurals(t *testing.T) {
164
165         trans := New()
166
167         tests := []struct {
168                 num      float64
169                 v        uint64
170                 expected locales.PluralRule
171         }{
172         // {
173         //      num:      1,
174         //      v:        0,
175         //      expected: locales.PluralRuleOne,
176         // },
177         // {
178         //      num:      2,
179         //      v:        0,
180         //      expected: locales.PluralRuleTwo,
181         // },
182         // {
183         //      num:      3,
184         //      v:        0,
185         //      expected: locales.PluralRuleFew,
186         // },
187         // {
188         //      num:      4,
189         //      v:        0,
190         //      expected: locales.PluralRuleOther,
191         // },
192         }
193
194         for _, tt := range tests {
195                 rule := trans.OrdinalPluralRule(tt.num, tt.v)
196                 if rule != tt.expected {
197                         t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
198                 }
199         }
200 }
201
202 func TestCardinalPlurals(t *testing.T) {
203
204         trans := New()
205
206         tests := []struct {
207                 num      float64
208                 v        uint64
209                 expected locales.PluralRule
210         }{
211         // {
212         //      num:      1,
213         //      v:        0,
214         //      expected: locales.PluralRuleOne,
215         // },
216         // {
217         //      num:      4,
218         //      v:        0,
219         //      expected: locales.PluralRuleOther,
220         // },
221         }
222
223         for _, tt := range tests {
224                 rule := trans.CardinalPluralRule(tt.num, tt.v)
225                 if rule != tt.expected {
226                         t.Errorf("Expected '%s' Got '%s'", tt.expected, rule)
227                 }
228         }
229 }
230
231 func TestDaysAbbreviated(t *testing.T) {
232
233         trans := New()
234         days := trans.WeekdaysAbbreviated()
235
236         for i, day := range days {
237                 s := trans.WeekdayAbbreviated(time.Weekday(i))
238                 if s != day {
239                         t.Errorf("Expected '%s' Got '%s'", day, s)
240                 }
241         }
242
243         tests := []struct {
244                 idx      int
245                 expected string
246         }{
247          {
248                 idx:      0,
249                 expected: "вс",
250          },
251          {
252                 idx:      1,
253                 expected: "пн",
254          },
255          {
256                 idx:      2,
257                 expected: "вт",
258          },
259          {
260                 idx:      3,
261                 expected: "ср",
262          },
263          {
264                 idx:      4,
265                 expected: "чт",
266          },
267          {
268                 idx:      5,
269                 expected: "пт",
270          },
271          {
272                 idx:      6,
273                 expected: "сб",
274          },
275         }
276
277         for _, tt := range tests {
278                 s := trans.WeekdayAbbreviated(time.Weekday(tt.idx))
279                 if s != tt.expected {
280                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
281                 }
282         }
283 }
284
285 func TestDaysNarrow(t *testing.T) {
286
287         trans := New()
288         days := trans.WeekdaysNarrow()
289
290         for i, day := range days {
291                 s := trans.WeekdayNarrow(time.Weekday(i))
292                 if s != day {
293                         t.Errorf("Expected '%s' Got '%s'", string(day), s)
294                 }
295         }
296
297         tests := []struct {
298                 idx      int
299                 expected string
300         }{
301          {
302                 idx:      0,
303                 expected: "вс",
304          },
305          {
306                 idx:      1,
307                 expected: "пн",
308          },
309          {
310                 idx:      2,
311                 expected: "вт",
312          },
313          {
314                 idx:      3,
315                 expected: "ср",
316          },
317          {
318                 idx:      4,
319                 expected: "чт",
320          },
321          {
322                 idx:      5,
323                 expected: "пт",
324          },
325          {
326                 idx:      6,
327                 expected: "сб",
328          },
329         }
330
331         for _, tt := range tests {
332                 s := trans.WeekdayNarrow(time.Weekday(tt.idx))
333                 if s != tt.expected {
334                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
335                 }
336         }
337 }
338
339 func TestDaysShort(t *testing.T) {
340
341         trans := New()
342         days := trans.WeekdaysShort()
343
344         for i, day := range days {
345                 s := trans.WeekdayShort(time.Weekday(i))
346                 if s != day {
347                         t.Errorf("Expected '%s' Got '%s'", day, s)
348                 }
349         }
350
351         tests := []struct {
352                 idx      int
353                 expected string
354         }{
355          {
356                 idx:      0,
357                 expected: "вс",
358          },
359          {
360                 idx:      1,
361                 expected: "пн",
362          },
363          {
364                 idx:      2,
365                 expected: "вт",
366          },
367          {
368                 idx:      3,
369                 expected: "ср",
370          },
371          {
372                 idx:      4,
373                 expected: "чт",
374          },
375          {
376                 idx:      5,
377                 expected: "пт",
378          },
379          {
380                 idx:      6,
381                 expected: "сб",
382          },
383         }
384
385         for _, tt := range tests {
386                 s := trans.WeekdayShort(time.Weekday(tt.idx))
387                 if s != tt.expected {
388                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
389                 }
390         }
391 }
392
393 func TestDaysWide(t *testing.T) {
394
395         trans := New()
396         days := trans.WeekdaysWide()
397
398         for i, day := range days {
399                 s := trans.WeekdayWide(time.Weekday(i))
400                 if s != day {
401                         t.Errorf("Expected '%s' Got '%s'", day, s)
402                 }
403         }
404
405         tests := []struct {
406                 idx      int
407                 expected string
408         }{
409          {
410                 idx:      0,
411                 expected: "воскресенье",
412          },
413          {
414                 idx:      1,
415                 expected: "понедельник",
416          },
417          {
418                 idx:      2,
419                 expected: "вторник",
420          },
421          {
422                 idx:      3,
423                 expected: "среда",
424          },
425          {
426                 idx:      4,
427                 expected: "четверг",
428          },
429          {
430                 idx:      5,
431                 expected: "пятница",
432          },
433          {
434                 idx:      6,
435                 expected: "суббота",
436          },
437         }
438
439         for _, tt := range tests {
440                 s := trans.WeekdayWide(time.Weekday(tt.idx))
441                 if s != tt.expected {
442                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
443                 }
444         }
445 }
446
447 func TestMonthsAbbreviated(t *testing.T) {
448
449         trans := New()
450         months := trans.MonthsAbbreviated()
451
452         for i, month := range months {
453                 s := trans.MonthAbbreviated(time.Month(i + 1))
454                 if s != month {
455                         t.Errorf("Expected '%s' Got '%s'", month, s)
456                 }
457         }
458
459         tests := []struct {
460                 idx      int
461                 expected string
462         }{
463          {
464                 idx:      1,
465                 expected: "янв.",
466          },
467          {
468                 idx:      2,
469                 expected: "февр.",
470          },
471          {
472                 idx:      3,
473                 expected: "мар.",
474          },
475          {
476                 idx:      4,
477                 expected: "апр.",
478          },
479          {
480                 idx:      5,
481                 expected: "мая",
482          },
483          {
484                 idx:      6,
485                 expected: "июн.",
486          },
487          {
488                 idx:      7,
489                 expected: "июл.",
490          },
491          {
492                 idx:      8,
493                 expected: "авг.",
494          },
495          {
496                 idx:      9,
497                 expected: "сент.",
498          },
499          {
500                 idx:      10,
501                 expected: "окт.",
502          },
503          {
504                 idx:      11,
505                 expected: "нояб.",
506          },
507          {
508                 idx:      12,
509                 expected: "дек.",
510          },
511         }
512
513         for _, tt := range tests {
514                 s := trans.MonthAbbreviated(time.Month(tt.idx))
515                 if s != tt.expected {
516                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
517                 }
518         }
519 }
520
521 func TestMonthsNarrow(t *testing.T) {
522
523         trans := New()
524         months := trans.MonthsNarrow()
525
526         for i, month := range months {
527                 s := trans.MonthNarrow(time.Month(i + 1))
528                 if s != month {
529                         t.Errorf("Expected '%s' Got '%s'", month, s)
530                 }
531         }
532
533         tests := []struct {
534                 idx      int
535                 expected string
536         }{
537          {
538                 idx:      1,
539                 expected: "Я",
540          },
541          {
542                 idx:      2,
543                 expected: "Ф",
544          },
545          {
546                 idx:      3,
547                 expected: "М",
548          },
549          {
550                 idx:      4,
551                 expected: "А",
552          },
553          {
554                 idx:      5,
555                 expected: "М",
556          },
557          {
558                 idx:      6,
559                 expected: "И",
560          },
561          {
562                 idx:      7,
563                 expected: "И",
564          },
565          {
566                 idx:      8,
567                 expected: "А",
568          },
569          {
570                 idx:      9,
571                 expected: "С",
572          },
573          {
574                 idx:      10,
575                 expected: "О",
576          },
577          {
578                 idx:      11,
579                 expected: "Н",
580          },
581          {
582                 idx:      12,
583                 expected: "Д",
584          },
585         }
586
587         for _, tt := range tests {
588                 s := trans.MonthNarrow(time.Month(tt.idx))
589                 if s != tt.expected {
590                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
591                 }
592         }
593 }
594
595 func TestMonthsWide(t *testing.T) {
596
597         trans := New()
598         months := trans.MonthsWide()
599
600         for i, month := range months {
601                 s := trans.MonthWide(time.Month(i + 1))
602                 if s != month {
603                         t.Errorf("Expected '%s' Got '%s'", month, s)
604                 }
605         }
606
607         tests := []struct {
608                 idx      int
609                 expected string
610         }{
611          {
612                 idx:      1,
613                 expected: "января",
614          },
615          {
616                 idx:      2,
617                 expected: "февраля",
618          },
619          {
620                 idx:      3,
621                 expected: "марта",
622          },
623          {
624                 idx:      4,
625                 expected: "апреля",
626          },
627          {
628                 idx:      5,
629                 expected: "мая",
630          },
631          {
632                 idx:      6,
633                 expected: "июня",
634          },
635          {
636                 idx:      7,
637                 expected: "июля",
638          },
639          {
640                 idx:      8,
641                 expected: "августа",
642          },
643          {
644                 idx:      9,
645                 expected: "сентября",
646          },
647          {
648                 idx:      10,
649                 expected: "октября",
650          },
651          {
652                 idx:      11,
653                 expected: "ноября",
654          },
655          {
656                 idx:      12,
657                 expected: "декабря",
658          },
659         }
660
661         for _, tt := range tests {
662                 s := string(trans.MonthWide(time.Month(tt.idx)))
663                 if s != tt.expected {
664                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
665                 }
666         }
667 }
668
669 func TestFmtTimeFull(t *testing.T) {
670
671         // loc, err := time.LoadLocation("America/Toronto")
672         // if err != nil {
673         //      t.Errorf("Expected '<nil>' Got '%s'", err)
674         // }
675
676         // fixed := time.FixedZone("OTHER", -4)
677
678         tests := []struct {
679                 t        time.Time
680                 expected string
681         }{
682         // {
683         //      t:        time.Date(2016, 02, 03, 9, 5, 1, 0, loc),
684         //      expected: "9:05:01 am Eastern Standard Time",
685         // },
686         // {
687         //      t:        time.Date(2016, 02, 03, 20, 5, 1, 0, fixed),
688         //      expected: "8:05:01 pm OTHER",
689         // },
690         }
691
692         trans := New()
693
694         for _, tt := range tests {
695                 s := trans.FmtTimeFull(tt.t)
696                 if s != tt.expected {
697                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
698                 }
699         }
700 }
701
702 func TestFmtTimeLong(t *testing.T) {
703
704         // loc, err := time.LoadLocation("America/Toronto")
705         // if err != nil {
706         //      t.Errorf("Expected '<nil>' Got '%s'", err)
707         // }
708
709         tests := []struct {
710                 t        time.Time
711                 expected string
712         }{
713         // {
714         //      t:        time.Date(2016, 02, 03, 9, 5, 1, 0, loc),
715         //      expected: "9:05:01 am EST",
716         // },
717         // {
718         //      t:        time.Date(2016, 02, 03, 20, 5, 1, 0, loc),
719         //      expected: "8:05:01 pm EST",
720         // },
721         }
722
723         trans := New()
724
725         for _, tt := range tests {
726                 s := trans.FmtTimeLong(tt.t)
727                 if s != tt.expected {
728                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
729                 }
730         }
731 }
732
733 func TestFmtTimeMedium(t *testing.T) {
734
735         tests := []struct {
736                 t        time.Time
737                 expected string
738         }{
739         // {
740         //      t:        time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC),
741         //      expected: "9:05:01 am",
742         // },
743         // {
744         //      t:        time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC),
745         //      expected: "8:05:01 pm",
746         // },
747         }
748
749         trans := New()
750
751         for _, tt := range tests {
752                 s := trans.FmtTimeMedium(tt.t)
753                 if s != tt.expected {
754                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
755                 }
756         }
757 }
758
759 func TestFmtTimeShort(t *testing.T) {
760
761         tests := []struct {
762                 t        time.Time
763                 expected string
764         }{
765         // {
766         //      t:        time.Date(2016, 02, 03, 9, 5, 1, 0, time.UTC),
767         //      expected: "9:05 am",
768         // },
769         // {
770         //      t:        time.Date(2016, 02, 03, 20, 5, 1, 0, time.UTC),
771         //      expected: "8:05 pm",
772         // },
773         }
774
775         trans := New()
776
777         for _, tt := range tests {
778                 s := trans.FmtTimeShort(tt.t)
779                 if s != tt.expected {
780                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
781                 }
782         }
783 }
784
785 func TestFmtDateFull(t *testing.T) {
786
787         tests := []struct {
788                 t        time.Time
789                 expected string
790         }{
791         // {
792         //      t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
793         //      expected: "Wednesday, February 3, 2016",
794         // },
795         }
796
797         trans := New()
798
799         for _, tt := range tests {
800                 s := trans.FmtDateFull(tt.t)
801                 if s != tt.expected {
802                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
803                 }
804         }
805 }
806
807 func TestFmtDateLong(t *testing.T) {
808
809         tests := []struct {
810                 t        time.Time
811                 expected string
812         }{
813         // {
814         //      t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
815         //      expected: "February 3, 2016",
816         // },
817         }
818
819         trans := New()
820
821         for _, tt := range tests {
822                 s := trans.FmtDateLong(tt.t)
823                 if s != tt.expected {
824                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
825                 }
826         }
827 }
828
829 func TestFmtDateMedium(t *testing.T) {
830
831         tests := []struct {
832                 t        time.Time
833                 expected string
834         }{
835         // {
836         //      t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
837         //      expected: "Feb 3, 2016",
838         // },
839         }
840
841         trans := New()
842
843         for _, tt := range tests {
844                 s := trans.FmtDateMedium(tt.t)
845                 if s != tt.expected {
846                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
847                 }
848         }
849 }
850
851 func TestFmtDateShort(t *testing.T) {
852
853         tests := []struct {
854                 t        time.Time
855                 expected string
856         }{
857         // {
858         //      t:        time.Date(2016, 02, 03, 9, 0, 1, 0, time.UTC),
859         //      expected: "2/3/16",
860         // },
861         // {
862         //      t:        time.Date(-500, 02, 03, 9, 0, 1, 0, time.UTC),
863         //      expected: "2/3/500",
864         // },
865         }
866
867         trans := New()
868
869         for _, tt := range tests {
870                 s := trans.FmtDateShort(tt.t)
871                 if s != tt.expected {
872                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
873                 }
874         }
875 }
876
877 func TestFmtNumber(t *testing.T) {
878
879         tests := []struct {
880                 num      float64
881                 v        uint64
882                 expected string
883         }{
884          {
885                 num:      1123456.5643,
886                 v:        2,
887                 expected: "1 123 456,56",
888          },
889          {
890                 num:      1123456.5643,
891                 v:        1,
892                 expected: "1 123 456,6",
893          },
894          {
895                 num:      221123456.5643,
896                 v:        3,
897                 expected: "221 123 456,564",
898          },
899          {
900                 num:      -221123456.5643,
901                 v:        3,
902                 expected: "-221 123 456,564",
903          },
904          {
905                 num:      -221123456.5643,
906                 v:        3,
907                 expected: "-221 123 456,564",
908          },
909          {
910                 num:      0,
911                 v:        2,
912                 expected: "0,00",
913          },
914          {
915                 num:      -0,
916                 v:        2,
917                 expected: "0,00",
918          },
919          {
920                 num:      -0,
921                 v:        2,
922                 expected: "0,00",
923          },
924         }
925
926         trans := New()
927
928         for _, tt := range tests {
929                 s := trans.FmtNumber(tt.num, tt.v)
930                 if s != tt.expected {
931                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
932                         t.Errorf("Expected and got bytes: ", []byte(s), []byte(tt.expected))
933                 }
934         }
935 }
936
937 func TestFmtCurrency(t *testing.T) {
938
939         tests := []struct {
940                 num      float64
941                 v        uint64
942                 currency currency.Type
943                 expected string
944         }{
945         // {
946         //      num:      1123456.5643,
947         //      v:        2,
948         //      currency: currency.USD,
949         //      expected: "$1,123,456.56",
950         // },
951         // {
952         //      num:      1123456.5643,
953         //      v:        1,
954         //      currency: currency.USD,
955         //      expected: "$1,123,456.60",
956         // },
957         // {
958         //      num:      221123456.5643,
959         //      v:        3,
960         //      currency: currency.USD,
961         //      expected: "$221,123,456.564",
962         // },
963         // {
964         //      num:      -221123456.5643,
965         //      v:        3,
966         //      currency: currency.USD,
967         //      expected: "-$221,123,456.564",
968         // },
969         // {
970         //      num:      -221123456.5643,
971         //      v:        3,
972         //      currency: currency.CAD,
973         //      expected: "-CAD 221,123,456.564",
974         // },
975         // {
976         //      num:      0,
977         //      v:        2,
978         //      currency: currency.USD,
979         //      expected: "$0.00",
980         // },
981         // {
982         //      num:      -0,
983         //      v:        2,
984         //      currency: currency.USD,
985         //      expected: "$0.00",
986         // },
987         // {
988         //      num:      -0,
989         //      v:        2,
990         //      currency: currency.CAD,
991         //      expected: "CAD 0.00",
992         // },
993         // {
994         //      num:      1.23,
995         //      v:        0,
996         //      currency: currency.USD,
997         //      expected: "$1.00",
998         // },
999         }
1000
1001         trans := New()
1002
1003         for _, tt := range tests {
1004                 s := trans.FmtCurrency(tt.num, tt.v, tt.currency)
1005                 if s != tt.expected {
1006                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
1007                 }
1008         }
1009 }
1010
1011 func TestFmtAccounting(t *testing.T) {
1012
1013         tests := []struct {
1014                 num      float64
1015                 v        uint64
1016                 currency currency.Type
1017                 expected string
1018         }{
1019         // {
1020         //      num:      1123456.5643,
1021         //      v:        2,
1022         //      currency: currency.USD,
1023         //      expected: "$1,123,456.56",
1024         // },
1025         // {
1026         //      num:      1123456.5643,
1027         //      v:        1,
1028         //      currency: currency.USD,
1029         //      expected: "$1,123,456.60",
1030         // },
1031         // {
1032         //      num:      221123456.5643,
1033         //      v:        3,
1034         //      currency: currency.USD,
1035         //      expected: "$221,123,456.564",
1036         // },
1037         // {
1038         //      num:      -221123456.5643,
1039         //      v:        3,
1040         //      currency: currency.USD,
1041         //      expected: "($221,123,456.564)",
1042         // },
1043         // {
1044         //      num:      -221123456.5643,
1045         //      v:        3,
1046         //      currency: currency.CAD,
1047         //      expected: "(CAD 221,123,456.564)",
1048         // },
1049         // {
1050         //      num:      -0,
1051         //      v:        2,
1052         //      currency: currency.USD,
1053         //      expected: "$0.00",
1054         // },
1055         // {
1056         //      num:      -0,
1057         //      v:        2,
1058         //      currency: currency.CAD,
1059         //      expected: "CAD 0.00",
1060         // },
1061         // {
1062         //      num:      1.23,
1063         //      v:        0,
1064         //      currency: currency.USD,
1065         //      expected: "$1.00",
1066         // },
1067         }
1068
1069         trans := New()
1070
1071         for _, tt := range tests {
1072                 s := trans.FmtAccounting(tt.num, tt.v, tt.currency)
1073                 if s != tt.expected {
1074                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
1075                 }
1076         }
1077 }
1078
1079 func TestFmtPercent(t *testing.T) {
1080
1081         tests := []struct {
1082                 num      float64
1083                 v        uint64
1084                 expected string
1085         }{
1086          {
1087                 num:      15,
1088                 v:        0,
1089                 expected: "15%",
1090          },
1091          {
1092                 num:      15,
1093                 v:        2,
1094                 expected: "15,00%",
1095          },
1096          {
1097                 num:      434.45,
1098                 v:        0,
1099                 expected: "434%",
1100          },
1101          {
1102                 num:      34.4,
1103                 v:        2,
1104                 expected: "34,40%",
1105          },
1106          {
1107                 num:      -34,
1108                 v:        0,
1109                 expected: "-34%",
1110          },
1111         }
1112
1113         trans := New()
1114
1115         for _, tt := range tests {
1116                 s := trans.FmtPercent(tt.num, tt.v)
1117                 if s != tt.expected {
1118                         t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
1119                 }
1120         }
1121 }