Get the name of a number, even if it's stupidly big.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

121 line
4.0 KiB

  1. import getShortKiloName from './getShortKiloName'
  2. it('should exist', () => {
  3. expect(getShortKiloName).toBeDefined()
  4. })
  5. it('should be a callable', () => {
  6. expect(typeof getShortKiloName).toBe('function')
  7. })
  8. it('should accept 1 argument', () => {
  9. expect(getShortKiloName).toHaveLength(1)
  10. })
  11. test.each`
  12. thousandPower | name
  13. ${0n} | ${''}
  14. ${1n} | ${'libo'}
  15. ${2n} | ${'milyon'}
  16. ${3n} | ${'bilyon'}
  17. ${4n} | ${'trilyon'}
  18. ${5n} | ${'kuwadrilyon'}
  19. ${6n} | ${'kuwintilyon'}
  20. ${7n} | ${'sekstilyon'}
  21. ${8n} | ${'septilyon'}
  22. ${9n} | ${'oktilyon'}
  23. ${10n} | ${'nonilyon'}
  24. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  25. expect(getShortKiloName(thousandPower)).toBe(name)
  26. })
  27. test.each`
  28. thousandPower | name
  29. ${11n} | ${'desilyon'}
  30. ${21n} | ${'bihintilyon'}
  31. ${31n} | ${'trihintilyon'}
  32. ${41n} | ${'kuwadrahintilyon'}
  33. ${51n} | ${'kuwinkuwahintilyon'}
  34. ${61n} | ${'seksahintilyon'}
  35. ${71n} | ${'septuwahintilyon'}
  36. ${81n} | ${'oktohintilyon'}
  37. ${91n} | ${'nonahintilyon'}
  38. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  39. expect(getShortKiloName(thousandPower)).toBe(name)
  40. })
  41. test.each`
  42. thousandPower | name
  43. ${101n} | ${'sentilyon'}
  44. ${201n} | ${'duwosentilyon'}
  45. ${301n} | ${'tresentilyon'}
  46. ${401n} | ${'kuwadringhentilyon'}
  47. ${501n} | ${'kuwinghentilyon'}
  48. ${601n} | ${'sesentilyon'}
  49. ${701n} | ${'septinghentilyon'}
  50. ${801n} | ${'oktinghentilyon'}
  51. ${901n} | ${'nonghentilyon'}
  52. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  53. expect(getShortKiloName(thousandPower)).toBe(name)
  54. })
  55. test.each`
  56. thousandPower | name
  57. ${1001n} | ${'milyatilyon'}
  58. ${2001n} | ${'duwomilyatilyon'}
  59. ${3001n} | ${'tremilyatilyon'}
  60. ${4001n} | ${'kuwatuwormilyatilyon'}
  61. ${5001n} | ${'kuwinmilyatilyon'}
  62. ${6001n} | ${'seksmilyatilyon'}
  63. ${7001n} | ${'septenmilyatilyon'}
  64. ${8001n} | ${'oktomilyatilyon'}
  65. ${9001n} | ${'nobemmilyatilyon'}
  66. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  67. expect(getShortKiloName(thousandPower)).toBe(name)
  68. })
  69. test.each`
  70. thousandPower | name
  71. ${10001n} | ${'desmilyatilyon'}
  72. ${20001n} | ${'bihinmilyatilyon'}
  73. ${30001n} | ${'trihinmilyatilyon'}
  74. ${40001n} | ${'kuwadrahinmilyatilyon'}
  75. ${50001n} | ${'kuwinkuwahinmilyatilyon'}
  76. ${60001n} | ${'seksahinmilyatilyon'}
  77. ${70001n} | ${'septuwahinmilyatilyon'}
  78. ${80001n} | ${'oktohinmilyatilyon'}
  79. ${90001n} | ${'nonahinmilyatilyon'}
  80. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  81. expect(getShortKiloName(thousandPower)).toBe(name)
  82. })
  83. test.each`
  84. thousandPower | name
  85. ${100001n} | ${'senmilyatilyon'}
  86. ${200001n} | ${'duwosenmilyatilyon'}
  87. ${300001n} | ${'tresenmilyatilyon'}
  88. ${400001n} | ${'kuwadringhenmilyatilyon'}
  89. ${500001n} | ${'kuwinghenmilyatilyon'}
  90. ${600001n} | ${'sesenmilyatilyon'}
  91. ${700001n} | ${'septinghenmilyatilyon'}
  92. ${800001n} | ${'oktinghenmilyatilyon'}
  93. ${900001n} | ${'nonghenmilyatilyon'}
  94. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  95. expect(getShortKiloName(thousandPower)).toBe(name)
  96. })
  97. test.each`
  98. thousandPower | name
  99. ${1000001n} | ${'milyamilyatilyon'}
  100. ${2000001n} | ${'duwomilyamilyatilyon'}
  101. ${3000001n} | ${'tremilyamilyatilyon'}
  102. ${4000001n} | ${'kuwatuwormilyamilyatilyon'}
  103. ${5000001n} | ${'kuwinmilyamilyatilyon'}
  104. ${6000001n} | ${'seksmilyamilyatilyon'}
  105. ${7000001n} | ${'septenmilyamilyatilyon'}
  106. ${8000001n} | ${'oktomilyamilyatilyon'}
  107. ${9000001n} | ${'nobemmilyamilyatilyon'}
  108. `('should return "$name" for 1000^$thousandPower', ({ name, thousandPower }) => {
  109. expect(getShortKiloName(thousandPower)).toBe(name)
  110. })