ts-data-forge 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/entry-point.mjs +2 -0
  2. package/dist/entry-point.mjs.map +1 -1
  3. package/dist/functional/index.d.mts +1 -0
  4. package/dist/functional/index.d.mts.map +1 -1
  5. package/dist/functional/index.mjs +2 -0
  6. package/dist/functional/index.mjs.map +1 -1
  7. package/dist/functional/ternary-result/impl/index.d.mts +29 -0
  8. package/dist/functional/ternary-result/impl/index.d.mts.map +1 -0
  9. package/dist/functional/ternary-result/impl/index.mjs +28 -0
  10. package/dist/functional/ternary-result/impl/index.mjs.map +1 -0
  11. package/dist/functional/ternary-result/impl/tag.d.mts +7 -0
  12. package/dist/functional/ternary-result/impl/tag.d.mts.map +1 -0
  13. package/dist/functional/ternary-result/impl/tag.mjs +9 -0
  14. package/dist/functional/ternary-result/impl/tag.mjs.map +1 -0
  15. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts +14 -0
  16. package/dist/functional/ternary-result/impl/ternary-result-err.d.mts.map +1 -0
  17. package/dist/functional/ternary-result/impl/ternary-result-err.mjs +21 -0
  18. package/dist/functional/ternary-result/impl/ternary-result-err.mjs.map +1 -0
  19. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts +18 -0
  20. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.d.mts.map +1 -0
  21. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs +24 -0
  22. package/dist/functional/ternary-result/impl/ternary-result-expect-to-be.mjs.map +1 -0
  23. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +29 -0
  24. package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -0
  25. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs +41 -0
  26. package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -0
  27. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts +27 -0
  28. package/dist/functional/ternary-result/impl/ternary-result-fold.d.mts.map +1 -0
  29. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs +36 -0
  30. package/dist/functional/ternary-result/impl/ternary-result-fold.mjs.map +1 -0
  31. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts +20 -0
  32. package/dist/functional/ternary-result/impl/ternary-result-from-promise.d.mts.map +1 -0
  33. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs +24 -0
  34. package/dist/functional/ternary-result/impl/ternary-result-from-promise.mjs.map +1 -0
  35. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts +17 -0
  36. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.d.mts.map +1 -0
  37. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs +33 -0
  38. package/dist/functional/ternary-result/impl/ternary-result-from-throwable.mjs.map +1 -0
  39. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts +20 -0
  40. package/dist/functional/ternary-result/impl/ternary-result-is-err.d.mts.map +1 -0
  41. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs +23 -0
  42. package/dist/functional/ternary-result/impl/ternary-result-is-err.mjs.map +1 -0
  43. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts +21 -0
  44. package/dist/functional/ternary-result/impl/ternary-result-is-ok.d.mts.map +1 -0
  45. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs +24 -0
  46. package/dist/functional/ternary-result/impl/ternary-result-is-ok.mjs.map +1 -0
  47. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts +17 -0
  48. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.d.mts.map +1 -0
  49. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs +28 -0
  50. package/dist/functional/ternary-result/impl/ternary-result-is-ternary-result.mjs.map +1 -0
  51. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts +21 -0
  52. package/dist/functional/ternary-result/impl/ternary-result-is-warn.d.mts.map +1 -0
  53. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs +24 -0
  54. package/dist/functional/ternary-result/impl/ternary-result-is-warn.mjs.map +1 -0
  55. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts +23 -0
  56. package/dist/functional/ternary-result/impl/ternary-result-map-err.d.mts.map +1 -0
  57. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs +26 -0
  58. package/dist/functional/ternary-result/impl/ternary-result-map-err.mjs.map +1 -0
  59. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts +21 -0
  60. package/dist/functional/ternary-result/impl/ternary-result-map-warn.d.mts.map +1 -0
  61. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs +29 -0
  62. package/dist/functional/ternary-result/impl/ternary-result-map-warn.mjs.map +1 -0
  63. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts +29 -0
  64. package/dist/functional/ternary-result/impl/ternary-result-map.d.mts.map +1 -0
  65. package/dist/functional/ternary-result/impl/ternary-result-map.mjs +35 -0
  66. package/dist/functional/ternary-result/impl/ternary-result-map.mjs.map +1 -0
  67. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts +16 -0
  68. package/dist/functional/ternary-result/impl/ternary-result-ok.d.mts.map +1 -0
  69. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs +23 -0
  70. package/dist/functional/ternary-result/impl/ternary-result-ok.mjs.map +1 -0
  71. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts +26 -0
  72. package/dist/functional/ternary-result/impl/ternary-result-or-else.d.mts.map +1 -0
  73. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs +19 -0
  74. package/dist/functional/ternary-result/impl/ternary-result-or-else.mjs.map +1 -0
  75. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts +16 -0
  76. package/dist/functional/ternary-result/impl/ternary-result-to-optional.d.mts.map +1 -0
  77. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs +25 -0
  78. package/dist/functional/ternary-result/impl/ternary-result-to-optional.mjs.map +1 -0
  79. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts +22 -0
  80. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.d.mts.map +1 -0
  81. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs +17 -0
  82. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-or.mjs.map +1 -0
  83. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts +18 -0
  84. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.d.mts.map +1 -0
  85. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs +36 -0
  86. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mjs.map +1 -0
  87. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts +17 -0
  88. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.d.mts.map +1 -0
  89. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs +22 -0
  90. package/dist/functional/ternary-result/impl/ternary-result-unwrap-err.mjs.map +1 -0
  91. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts +22 -0
  92. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.d.mts.map +1 -0
  93. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs +17 -0
  94. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mjs.map +1 -0
  95. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts +17 -0
  96. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.d.mts.map +1 -0
  97. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs +13 -0
  98. package/dist/functional/ternary-result/impl/ternary-result-unwrap-ok.mjs.map +1 -0
  99. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts +18 -0
  100. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.d.mts.map +1 -0
  101. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs +36 -0
  102. package/dist/functional/ternary-result/impl/ternary-result-unwrap-throw.mjs.map +1 -0
  103. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts +19 -0
  104. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.d.mts.map +1 -0
  105. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs +17 -0
  106. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mjs.map +1 -0
  107. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts +18 -0
  108. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.d.mts.map +1 -0
  109. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs +32 -0
  110. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mjs.map +1 -0
  111. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts +17 -0
  112. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.d.mts.map +1 -0
  113. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs +22 -0
  114. package/dist/functional/ternary-result/impl/ternary-result-unwrap-warn.mjs.map +1 -0
  115. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts +18 -0
  116. package/dist/functional/ternary-result/impl/ternary-result-warn.d.mts.map +1 -0
  117. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs +26 -0
  118. package/dist/functional/ternary-result/impl/ternary-result-warn.mjs.map +1 -0
  119. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts +26 -0
  120. package/dist/functional/ternary-result/impl/ternary-result-zip.d.mts.map +1 -0
  121. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs +48 -0
  122. package/dist/functional/ternary-result/impl/ternary-result-zip.mjs.map +1 -0
  123. package/dist/functional/ternary-result/impl/types.d.mts +25 -0
  124. package/dist/functional/ternary-result/impl/types.d.mts.map +1 -0
  125. package/dist/functional/ternary-result/impl/types.mjs +2 -0
  126. package/dist/functional/ternary-result/impl/types.mjs.map +1 -0
  127. package/dist/functional/ternary-result/impl/variant-name.d.mts +3 -0
  128. package/dist/functional/ternary-result/impl/variant-name.d.mts.map +1 -0
  129. package/dist/functional/ternary-result/impl/variant-name.mjs +16 -0
  130. package/dist/functional/ternary-result/impl/variant-name.mjs.map +1 -0
  131. package/dist/functional/ternary-result/index.d.mts +2 -0
  132. package/dist/functional/ternary-result/index.d.mts.map +1 -0
  133. package/dist/functional/ternary-result/index.mjs +3 -0
  134. package/dist/functional/ternary-result/index.mjs.map +1 -0
  135. package/dist/globals.d.mts +55 -2
  136. package/dist/json/json.d.mts +9 -3
  137. package/dist/json/json.d.mts.map +1 -1
  138. package/dist/json/json.mjs +6 -0
  139. package/dist/json/json.mjs.map +1 -1
  140. package/package.json +13 -13
  141. package/src/array/impl/array-utils-creation.test.mts +187 -74
  142. package/src/array/impl/array-utils-element-access.test.mts +19 -3
  143. package/src/array/impl/array-utils-iterators.test.mts +44 -24
  144. package/src/array/impl/array-utils-modification.test.mts +36 -33
  145. package/src/array/impl/array-utils-reducing-value.test.mts +47 -16
  146. package/src/array/impl/array-utils-search.test.mts +42 -9
  147. package/src/array/impl/array-utils-set-op.test.mts +54 -26
  148. package/src/array/impl/array-utils-size.test.mts +1 -0
  149. package/src/array/impl/array-utils-slice-clamped.test.mts +20 -11
  150. package/src/array/impl/array-utils-slicing.test.mts +27 -21
  151. package/src/array/impl/array-utils-transformation.test.mts +140 -92
  152. package/src/array/impl/array-utils-validation.test.mts +58 -10
  153. package/src/array/impl/array.test.mts +5 -5
  154. package/src/collections/imap-mapped.test.mts +63 -18
  155. package/src/collections/imap.test.mts +74 -26
  156. package/src/collections/iset-mapped.test.mts +81 -30
  157. package/src/collections/iset.test.mts +168 -68
  158. package/src/collections/queue.test.mts +32 -1
  159. package/src/collections/stack.test.mts +22 -8
  160. package/src/functional/index.mts +1 -0
  161. package/src/functional/match.test.mts +1 -1
  162. package/src/functional/optional.test.mts +61 -4
  163. package/src/functional/pipe.test.mts +10 -1
  164. package/src/functional/result.test.mts +127 -4
  165. package/src/functional/ternary-result/impl/index.mts +28 -0
  166. package/src/functional/ternary-result/impl/tag.mts +11 -0
  167. package/src/functional/ternary-result/impl/ternary-result-err.mts +18 -0
  168. package/src/functional/ternary-result/impl/ternary-result-expect-to-be.mts +53 -0
  169. package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +95 -0
  170. package/src/functional/ternary-result/impl/ternary-result-fold.mts +93 -0
  171. package/src/functional/ternary-result/impl/ternary-result-from-promise.mts +27 -0
  172. package/src/functional/ternary-result/impl/ternary-result-from-throwable.mts +31 -0
  173. package/src/functional/ternary-result/impl/ternary-result-is-err.mts +23 -0
  174. package/src/functional/ternary-result/impl/ternary-result-is-ok.mts +24 -0
  175. package/src/functional/ternary-result/impl/ternary-result-is-ternary-result.mts +27 -0
  176. package/src/functional/ternary-result/impl/ternary-result-is-warn.mts +24 -0
  177. package/src/functional/ternary-result/impl/ternary-result-map-err.mts +64 -0
  178. package/src/functional/ternary-result/impl/ternary-result-map-warn.mts +66 -0
  179. package/src/functional/ternary-result/impl/ternary-result-map.mts +81 -0
  180. package/src/functional/ternary-result/impl/ternary-result-ok.mts +20 -0
  181. package/src/functional/ternary-result/impl/ternary-result-or-else.mts +66 -0
  182. package/src/functional/ternary-result/impl/ternary-result-to-optional.mts +25 -0
  183. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-or.mts +45 -0
  184. package/src/functional/ternary-result/impl/ternary-result-unwrap-err-throw.mts +40 -0
  185. package/src/functional/ternary-result/impl/ternary-result-unwrap-err.mts +22 -0
  186. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok-or.mts +45 -0
  187. package/src/functional/ternary-result/impl/ternary-result-unwrap-ok.mts +32 -0
  188. package/src/functional/ternary-result/impl/ternary-result-unwrap-throw.mts +45 -0
  189. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-or.mts +42 -0
  190. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn-throw.mts +38 -0
  191. package/src/functional/ternary-result/impl/ternary-result-unwrap-warn.mts +22 -0
  192. package/src/functional/ternary-result/impl/ternary-result-warn.mts +23 -0
  193. package/src/functional/ternary-result/impl/ternary-result-zip.mts +53 -0
  194. package/src/functional/ternary-result/impl/types.mts +39 -0
  195. package/src/functional/ternary-result/impl/variant-name.mts +17 -0
  196. package/src/functional/ternary-result/index.mts +1 -0
  197. package/src/functional/ternary-result.test.mts +214 -0
  198. package/src/globals.d.mts +55 -2
  199. package/src/guard/is-non-empty-string.test.mts +5 -2
  200. package/src/guard/is-non-null-object.test.mts +3 -5
  201. package/src/guard/is-primitive.test.mts +5 -3
  202. package/src/guard/is-record.test.mts +1 -1
  203. package/src/guard/is-type.test.mts +35 -20
  204. package/src/guard/key-is-in.test.mts +1 -1
  205. package/src/iterator/range.test.mts +22 -16
  206. package/src/json/json.mts +9 -3
  207. package/src/json/json.test.mts +140 -64
  208. package/src/number/branded-types/finite-number.test.mts +3 -2
  209. package/src/number/branded-types/int.test.mts +4 -3
  210. package/src/number/branded-types/int16.test.mts +9 -3
  211. package/src/number/branded-types/int32.test.mts +9 -3
  212. package/src/number/branded-types/non-negative-finite-number.test.mts +6 -4
  213. package/src/number/branded-types/non-negative-int16.test.mts +8 -3
  214. package/src/number/branded-types/non-negative-int32.test.mts +8 -3
  215. package/src/number/branded-types/non-zero-finite-number.test.mts +6 -3
  216. package/src/number/branded-types/non-zero-int.test.mts +6 -3
  217. package/src/number/branded-types/non-zero-int16.test.mts +9 -3
  218. package/src/number/branded-types/non-zero-int32.test.mts +9 -3
  219. package/src/number/branded-types/non-zero-safe-int.test.mts +10 -3
  220. package/src/number/branded-types/non-zero-uint16.test.mts +8 -3
  221. package/src/number/branded-types/non-zero-uint32.test.mts +8 -3
  222. package/src/number/branded-types/positive-finite-number.test.mts +7 -3
  223. package/src/number/branded-types/positive-int.test.mts +5 -3
  224. package/src/number/branded-types/positive-int16.test.mts +8 -3
  225. package/src/number/branded-types/positive-int32.test.mts +8 -3
  226. package/src/number/branded-types/positive-safe-int.test.mts +8 -3
  227. package/src/number/branded-types/positive-uint16.test.mts +8 -3
  228. package/src/number/branded-types/positive-uint32.test.mts +8 -3
  229. package/src/number/branded-types/safe-int.test.mts +8 -2
  230. package/src/number/branded-types/safe-uint.test.mts +8 -3
  231. package/src/number/branded-types/uint.test.mts +5 -3
  232. package/src/number/branded-types/uint16.test.mts +8 -3
  233. package/src/number/branded-types/uint32.test.mts +8 -3
  234. package/src/number/enum/int8.test.mts +8 -3
  235. package/src/number/enum/uint8.test.mts +6 -3
  236. package/src/number/num.test.mts +16 -2
  237. package/src/object/object.test.mts +26 -13
  238. package/src/others/cast-mutable.test.mts +10 -8
  239. package/src/others/cast-readonly.test.mts +9 -5
  240. package/src/others/if-then.test.mts +4 -1
  241. package/src/others/map-nullable.test.mts +28 -1
  242. package/src/others/memoize-function.test.mts +20 -17
  243. package/src/others/tuple.test.mts +3 -2
  244. package/src/others/unknown-to-string.test.mts +15 -2
  245. package/src/promise/promise.test.mts +6 -1
@@ -3,8 +3,8 @@ import { range } from '../../iterator/index.mjs';
3
3
  import { asInt16, Int16, isInt16 } from './int16.mjs';
4
4
  import { asNonZeroInt16 } from './non-zero-int16.mjs';
5
5
 
6
- describe('Int16', () => {
7
- describe('asInt16', () => {
6
+ describe('Int16 test', () => {
7
+ describe(asInt16, () => {
8
8
  test('accepts valid int16 values', () => {
9
9
  expect(() => asInt16(0)).not.toThrow();
10
10
  expect(() => asInt16(1)).not.toThrow();
@@ -49,7 +49,7 @@ describe('Int16', () => {
49
49
  });
50
50
  });
51
51
 
52
- describe('isInt16', () => {
52
+ describe(isInt16, () => {
53
53
  test('correctly identifies int16 values', () => {
54
54
  expect(isInt16(0)).toBe(true);
55
55
  expect(isInt16(1)).toBe(true);
@@ -109,18 +109,21 @@ describe('Int16', () => {
109
109
 
110
110
  test('add (with clamping)', () => {
111
111
  const result = Int16.add(asInt16(32_000), asInt16(1000));
112
+
112
113
  expect(result).toBe(32_767); // clamped to max
113
114
  expect(Int16.add(a, b)).toBe(150);
114
115
  });
115
116
 
116
117
  test('sub (with clamping)', () => {
117
118
  const result = Int16.sub(asInt16(-32_000), asInt16(1000));
119
+
118
120
  expect(result).toBe(-32_768); // clamped to min
119
121
  expect(Int16.sub(a, b)).toBe(50);
120
122
  });
121
123
 
122
124
  test('mul (with clamping)', () => {
123
125
  const result = Int16.mul(asInt16(1000), asInt16(100));
126
+
124
127
  expect(result).toBe(32_767); // clamped to max
125
128
  expect(Int16.mul(asInt16(10), asInt16(5))).toBe(50);
126
129
  });
@@ -133,6 +136,7 @@ describe('Int16', () => {
133
136
 
134
137
  test('pow (with clamping)', () => {
135
138
  const result = Int16.pow(asInt16(200), asInt16(3));
139
+
136
140
  expect(result).toBe(32_767); // clamped to max
137
141
  expect(Int16.pow(asInt16(2), asInt16(3))).toBe(8);
138
142
  });
@@ -145,6 +149,7 @@ describe('Int16', () => {
145
149
 
146
150
  for (const _ of range(10)) {
147
151
  const result = Int16.random(min, max);
152
+
148
153
  expect(result).toBeGreaterThanOrEqual(min);
149
154
  expect(result).toBeLessThanOrEqual(max);
150
155
  expect(Int16.is(result)).toBe(true);
@@ -155,6 +160,7 @@ describe('Int16', () => {
155
160
  test('generates values within Int16 range', () => {
156
161
  for (const _ of range(10)) {
157
162
  const result = Int16.random(-20, 20);
163
+
158
164
  expect(result).toBeGreaterThanOrEqual(Int16.MIN_VALUE);
159
165
  expect(result).toBeLessThanOrEqual(Int16.MAX_VALUE);
160
166
  }
@@ -3,8 +3,8 @@ import { range } from '../../iterator/index.mjs';
3
3
  import { asInt32, Int32, isInt32 } from './int32.mjs';
4
4
  import { asNonZeroInt32 } from './non-zero-int32.mjs';
5
5
 
6
- describe('Int32', () => {
7
- describe('asInt32', () => {
6
+ describe('Int32 test', () => {
7
+ describe(asInt32, () => {
8
8
  test('accepts valid int32 values', () => {
9
9
  expect(() => asInt32(0)).not.toThrow();
10
10
  expect(() => asInt32(1)).not.toThrow();
@@ -49,7 +49,7 @@ describe('Int32', () => {
49
49
  });
50
50
  });
51
51
 
52
- describe('isInt32', () => {
52
+ describe(isInt32, () => {
53
53
  test('correctly identifies int32 values', () => {
54
54
  expect(isInt32(0)).toBe(true);
55
55
  expect(isInt32(1)).toBe(true);
@@ -109,18 +109,21 @@ describe('Int32', () => {
109
109
 
110
110
  test('add (with clamping)', () => {
111
111
  const result = Int32.add(asInt32(2_147_483_000), asInt32(1000));
112
+
112
113
  expect(result).toBe(2_147_483_647); // clamped to max
113
114
  expect(Int32.add(a, b)).toBe(1_500_000);
114
115
  });
115
116
 
116
117
  test('sub (with clamping)', () => {
117
118
  const result = Int32.sub(asInt32(-2_147_483_000), asInt32(1000));
119
+
118
120
  expect(result).toBe(-2_147_483_648); // clamped to min
119
121
  expect(Int32.sub(a, b)).toBe(500_000);
120
122
  });
121
123
 
122
124
  test('mul (with clamping)', () => {
123
125
  const result = Int32.mul(asInt32(100_000), asInt32(100_000));
126
+
124
127
  expect(result).toBe(2_147_483_647); // clamped to max
125
128
  expect(Int32.mul(asInt32(1000), asInt32(5))).toBe(5000);
126
129
  });
@@ -133,6 +136,7 @@ describe('Int32', () => {
133
136
 
134
137
  test('pow (with clamping)', () => {
135
138
  const result = Int32.pow(asInt32(10_000), asInt32(3));
139
+
136
140
  expect(result).toBe(2_147_483_647); // clamped to max
137
141
  expect(Int32.pow(asInt32(2), asInt32(3))).toBe(8);
138
142
  });
@@ -145,6 +149,7 @@ describe('Int32', () => {
145
149
 
146
150
  for (const _ of range(10)) {
147
151
  const result = Int32.random(min, max);
152
+
148
153
  expect(result).toBeGreaterThanOrEqual(min);
149
154
  expect(result).toBeLessThanOrEqual(max);
150
155
  expect(Int32.is(result)).toBe(true);
@@ -155,6 +160,7 @@ describe('Int32', () => {
155
160
  test('generates values within Int32 range', () => {
156
161
  for (const _ of range(10)) {
157
162
  const result = Int32.random(-20, 20);
163
+
158
164
  expect(result).toBeGreaterThanOrEqual(Int32.MIN_VALUE);
159
165
  expect(result).toBeLessThanOrEqual(Int32.MAX_VALUE);
160
166
  }
@@ -6,8 +6,8 @@ import {
6
6
  NonNegativeFiniteNumber,
7
7
  } from './non-negative-finite-number.mjs';
8
8
 
9
- describe('NonNegativeFiniteNumber', () => {
10
- describe('asNonNegativeFiniteNumber', () => {
9
+ describe('NonNegativeFiniteNumber test', () => {
10
+ describe(asNonNegativeFiniteNumber, () => {
11
11
  test('accepts valid non-negative finite numbers', () => {
12
12
  expect(() => asNonNegativeFiniteNumber(0)).not.toThrow();
13
13
  expect(() => asNonNegativeFiniteNumber(1)).not.toThrow();
@@ -55,7 +55,7 @@ describe('NonNegativeFiniteNumber', () => {
55
55
  );
56
56
  });
57
57
 
58
- describe('isNonNegativeFiniteNumber', () => {
58
+ describe(isNonNegativeFiniteNumber, () => {
59
59
  test('correctly identifies non-negative finite numbers', () => {
60
60
  expect(isNonNegativeFiniteNumber(0)).toBe(true);
61
61
  expect(isNonNegativeFiniteNumber(1)).toBe(true);
@@ -131,7 +131,7 @@ describe('NonNegativeFiniteNumber', () => {
131
131
 
132
132
  test('div method exists', () => {
133
133
  // Test that the div function exists and is of the right type
134
- expect(typeof NonNegativeFiniteNumber.div).toBe('function');
134
+ expectTypeOf(NonNegativeFiniteNumber.div).toBeFunction();
135
135
  // Note: Cannot test division without type assertions due to strict type requirements
136
136
  });
137
137
 
@@ -158,6 +158,7 @@ describe('NonNegativeFiniteNumber', () => {
158
158
 
159
159
  for (const _ of range(10)) {
160
160
  const result = NonNegativeFiniteNumber.random(min, max);
161
+
161
162
  expect(result).toBeGreaterThanOrEqual(min);
162
163
  expect(result).toBeLessThanOrEqual(max);
163
164
  expect(NonNegativeFiniteNumber.is(result)).toBe(true);
@@ -171,6 +172,7 @@ describe('NonNegativeFiniteNumber', () => {
171
172
 
172
173
  for (const _ of range(10)) {
173
174
  const result = NonNegativeFiniteNumber.random(min, max);
175
+
174
176
  expect(result).toBeGreaterThanOrEqual(0);
175
177
  expect(result).toBeLessThanOrEqual(5);
176
178
  }
@@ -7,8 +7,8 @@ import {
7
7
  } from './non-negative-int16.mjs';
8
8
  import { asPositiveInt16 } from './positive-int16.mjs';
9
9
 
10
- describe('NonNegativeInt16', () => {
11
- describe('asNonNegativeInt16', () => {
10
+ describe('NonNegativeInt16 test', () => {
11
+ describe(asNonNegativeInt16, () => {
12
12
  test('accepts valid non-negative int16 values', () => {
13
13
  expect(() => asNonNegativeInt16(0)).not.toThrow();
14
14
  expect(() => asNonNegativeInt16(1)).not.toThrow();
@@ -65,7 +65,7 @@ describe('NonNegativeInt16', () => {
65
65
  );
66
66
  });
67
67
 
68
- describe('isNonNegativeInt16', () => {
68
+ describe(isNonNegativeInt16, () => {
69
69
  test('correctly identifies non-negative int16 values', () => {
70
70
  expect(isNonNegativeInt16(0)).toBe(true);
71
71
  expect(isNonNegativeInt16(1)).toBe(true);
@@ -125,6 +125,7 @@ describe('NonNegativeInt16', () => {
125
125
  asNonNegativeInt16(32_000),
126
126
  asNonNegativeInt16(1000),
127
127
  );
128
+
128
129
  expect(result).toBe(32_767); // clamped to max
129
130
  expect(NonNegativeInt16.add(a, b)).toBe(150);
130
131
  });
@@ -140,6 +141,7 @@ describe('NonNegativeInt16', () => {
140
141
  asNonNegativeInt16(1000),
141
142
  asNonNegativeInt16(100),
142
143
  );
144
+
143
145
  expect(result).toBe(32_767); // clamped to max
144
146
  expect(
145
147
  NonNegativeInt16.mul(asNonNegativeInt16(10), asNonNegativeInt16(5)),
@@ -161,6 +163,7 @@ describe('NonNegativeInt16', () => {
161
163
  asNonNegativeInt16(200),
162
164
  asNonNegativeInt16(3),
163
165
  );
166
+
164
167
  expect(result).toBe(32_767); // clamped to max
165
168
  expect(
166
169
  NonNegativeInt16.pow(asNonNegativeInt16(2), asNonNegativeInt16(3)),
@@ -175,6 +178,7 @@ describe('NonNegativeInt16', () => {
175
178
 
176
179
  for (const _ of range(10)) {
177
180
  const result = NonNegativeInt16.random(min, max);
181
+
178
182
  expect(result).toBeGreaterThanOrEqual(min);
179
183
  expect(result).toBeLessThanOrEqual(max);
180
184
  expect(NonNegativeInt16.is(result)).toBe(true);
@@ -186,6 +190,7 @@ describe('NonNegativeInt16', () => {
186
190
  test('generates values within NonNegativeInt16 range', () => {
187
191
  for (const _ of range(10)) {
188
192
  const result = NonNegativeInt16.random(0, 30);
193
+
189
194
  expect(result).toBeGreaterThanOrEqual(0);
190
195
  expect(result).toBeLessThanOrEqual(32_767);
191
196
  }
@@ -7,8 +7,8 @@ import {
7
7
  } from './non-negative-int32.mjs';
8
8
  import { asPositiveInt32 } from './positive-int32.mjs';
9
9
 
10
- describe('NonNegativeInt32', () => {
11
- describe('asNonNegativeInt32', () => {
10
+ describe('NonNegativeInt32 test', () => {
11
+ describe(asNonNegativeInt32, () => {
12
12
  test('accepts valid non-negative int32 values', () => {
13
13
  expect(() => asNonNegativeInt32(0)).not.toThrow();
14
14
  expect(() => asNonNegativeInt32(1)).not.toThrow();
@@ -65,7 +65,7 @@ describe('NonNegativeInt32', () => {
65
65
  );
66
66
  });
67
67
 
68
- describe('isNonNegativeInt32', () => {
68
+ describe(isNonNegativeInt32, () => {
69
69
  test('correctly identifies non-negative int32 values', () => {
70
70
  expect(isNonNegativeInt32(0)).toBe(true);
71
71
  expect(isNonNegativeInt32(1)).toBe(true);
@@ -125,6 +125,7 @@ describe('NonNegativeInt32', () => {
125
125
  asNonNegativeInt32(2_147_483_000),
126
126
  asNonNegativeInt32(1000),
127
127
  );
128
+
128
129
  expect(result).toBe(2_147_483_647); // clamped to max
129
130
  expect(NonNegativeInt32.add(a, b)).toBe(1_500_000);
130
131
  });
@@ -140,6 +141,7 @@ describe('NonNegativeInt32', () => {
140
141
  asNonNegativeInt32(100_000),
141
142
  asNonNegativeInt32(100_000),
142
143
  );
144
+
143
145
  expect(result).toBe(2_147_483_647); // clamped to max
144
146
  expect(
145
147
  NonNegativeInt32.mul(asNonNegativeInt32(1000), asNonNegativeInt32(5)),
@@ -164,6 +166,7 @@ describe('NonNegativeInt32', () => {
164
166
  asNonNegativeInt32(10_000),
165
167
  asNonNegativeInt32(3),
166
168
  );
169
+
167
170
  expect(result).toBe(2_147_483_647); // clamped to max
168
171
  expect(
169
172
  NonNegativeInt32.pow(asNonNegativeInt32(2), asNonNegativeInt32(3)),
@@ -178,6 +181,7 @@ describe('NonNegativeInt32', () => {
178
181
 
179
182
  for (const _ of range(10)) {
180
183
  const result = NonNegativeInt32.random(min, max);
184
+
181
185
  expect(result).toBeGreaterThanOrEqual(min);
182
186
  expect(result).toBeLessThanOrEqual(max);
183
187
  expect(NonNegativeInt32.is(result)).toBe(true);
@@ -189,6 +193,7 @@ describe('NonNegativeInt32', () => {
189
193
  test('generates values within NonNegativeInt32 range', () => {
190
194
  for (const _ of range(10)) {
191
195
  const result = NonNegativeInt32.random(0, 30);
196
+
192
197
  expect(result).toBeGreaterThanOrEqual(0);
193
198
  expect(result).toBeLessThanOrEqual(2_147_483_647);
194
199
  }
@@ -6,8 +6,8 @@ import {
6
6
  NonZeroFiniteNumber,
7
7
  } from './non-zero-finite-number.mjs';
8
8
 
9
- describe('NonZeroFiniteNumber', () => {
10
- describe('asNonZeroFiniteNumber', () => {
9
+ describe('NonZeroFiniteNumber test', () => {
10
+ describe(asNonZeroFiniteNumber, () => {
11
11
  test('accepts valid non-zero finite numbers', () => {
12
12
  expect(() => asNonZeroFiniteNumber(1)).not.toThrow();
13
13
  expect(() => asNonZeroFiniteNumber(-1)).not.toThrow();
@@ -55,7 +55,7 @@ describe('NonZeroFiniteNumber', () => {
55
55
  );
56
56
  });
57
57
 
58
- describe('isNonZeroFiniteNumber', () => {
58
+ describe(isNonZeroFiniteNumber, () => {
59
59
  test('correctly identifies non-zero finite numbers', () => {
60
60
  expect(isNonZeroFiniteNumber(1)).toBe(true);
61
61
  expect(isNonZeroFiniteNumber(-1)).toBe(true);
@@ -155,6 +155,7 @@ describe('NonZeroFiniteNumber', () => {
155
155
 
156
156
  for (const _ of range(10)) {
157
157
  const result = NonZeroFiniteNumber.random(min, max);
158
+
158
159
  expect(result).toBeGreaterThanOrEqual(min);
159
160
  expect(result).toBeLessThanOrEqual(max);
160
161
  expect(NonZeroFiniteNumber.is(result)).toBe(true);
@@ -168,6 +169,7 @@ describe('NonZeroFiniteNumber', () => {
168
169
 
169
170
  for (const _ of range(10)) {
170
171
  const result = NonZeroFiniteNumber.random(min, max);
172
+
171
173
  expect(result).toBeGreaterThanOrEqual(min);
172
174
  expect(result).toBeLessThanOrEqual(max);
173
175
  expect(NonZeroFiniteNumber.is(result)).toBe(true);
@@ -181,6 +183,7 @@ describe('NonZeroFiniteNumber', () => {
181
183
 
182
184
  for (const _ of range(10)) {
183
185
  const result = NonZeroFiniteNumber.random(min, max);
186
+
184
187
  expect(result).toBeGreaterThanOrEqual(min);
185
188
  expect(result).toBeLessThanOrEqual(max);
186
189
  expect(NonZeroFiniteNumber.is(result)).toBe(true);
@@ -2,8 +2,8 @@ import { expectType } from '../../expect-type.mjs';
2
2
  import { range } from '../../iterator/index.mjs';
3
3
  import { asNonZeroInt, isNonZeroInt, NonZeroInt } from './non-zero-int.mjs';
4
4
 
5
- describe('NonZeroInt', () => {
6
- describe('asNonZeroInt', () => {
5
+ describe('NonZeroInt test', () => {
6
+ describe(asNonZeroInt, () => {
7
7
  test('accepts valid non-zero integers', () => {
8
8
  expect(() => asNonZeroInt(1)).not.toThrow();
9
9
  expect(() => asNonZeroInt(-1)).not.toThrow();
@@ -46,7 +46,7 @@ describe('NonZeroInt', () => {
46
46
  });
47
47
  });
48
48
 
49
- describe('isNonZeroInt', () => {
49
+ describe(isNonZeroInt, () => {
50
50
  test('correctly identifies non-zero integers', () => {
51
51
  expect(isNonZeroInt(1)).toBe(true);
52
52
  expect(isNonZeroInt(-1)).toBe(true);
@@ -131,6 +131,7 @@ describe('NonZeroInt', () => {
131
131
 
132
132
  for (const _ of range(10)) {
133
133
  const result = NonZeroInt.random(min, max);
134
+
134
135
  expect(result).toBeGreaterThanOrEqual(min);
135
136
  expect(result).toBeLessThanOrEqual(max);
136
137
  expect(NonZeroInt.is(result)).toBe(true);
@@ -145,6 +146,7 @@ describe('NonZeroInt', () => {
145
146
 
146
147
  for (const _ of range(10)) {
147
148
  const result = NonZeroInt.random(min, max);
149
+
148
150
  expect(result).toBeGreaterThanOrEqual(min);
149
151
  expect(result).toBeLessThanOrEqual(max);
150
152
  expect(NonZeroInt.is(result)).toBe(true);
@@ -159,6 +161,7 @@ describe('NonZeroInt', () => {
159
161
 
160
162
  for (const _ of range(10)) {
161
163
  const result = NonZeroInt.random(min, max);
164
+
162
165
  expect(result).toBeGreaterThanOrEqual(min);
163
166
  expect(result).toBeLessThanOrEqual(max);
164
167
  expect(NonZeroInt.is(result)).toBe(true);
@@ -6,8 +6,8 @@ import {
6
6
  NonZeroInt16,
7
7
  } from './non-zero-int16.mjs';
8
8
 
9
- describe('NonZeroInt16', () => {
10
- describe('asNonZeroInt16', () => {
9
+ describe('NonZeroInt16 test', () => {
10
+ describe(asNonZeroInt16, () => {
11
11
  test('accepts valid non-zero int16 values', () => {
12
12
  expect(() => asNonZeroInt16(1)).not.toThrow();
13
13
  expect(() => asNonZeroInt16(-1)).not.toThrow();
@@ -62,7 +62,7 @@ describe('NonZeroInt16', () => {
62
62
  );
63
63
  });
64
64
 
65
- describe('isNonZeroInt16', () => {
65
+ describe(isNonZeroInt16, () => {
66
66
  test('correctly identifies non-zero int16 values', () => {
67
67
  expect(isNonZeroInt16(1)).toBe(true);
68
68
  expect(isNonZeroInt16(-1)).toBe(true);
@@ -127,6 +127,7 @@ describe('NonZeroInt16', () => {
127
127
  asNonZeroInt16(32_000),
128
128
  asNonZeroInt16(1000),
129
129
  );
130
+
130
131
  expect(result).toBe(32_767); // clamped to max
131
132
  expect(NonZeroInt16.add(a, b)).toBe(150);
132
133
  });
@@ -136,6 +137,7 @@ describe('NonZeroInt16', () => {
136
137
  asNonZeroInt16(-32_000),
137
138
  asNonZeroInt16(1000),
138
139
  );
140
+
139
141
  expect(result).toBe(-32_768); // clamped to min
140
142
  expect(NonZeroInt16.sub(a, b)).toBe(50);
141
143
  });
@@ -145,6 +147,7 @@ describe('NonZeroInt16', () => {
145
147
  asNonZeroInt16(1000),
146
148
  asNonZeroInt16(100),
147
149
  );
150
+
148
151
  expect(result).toBe(32_767); // clamped to max
149
152
  expect(NonZeroInt16.mul(asNonZeroInt16(10), asNonZeroInt16(5))).toBe(50);
150
153
  });
@@ -157,6 +160,7 @@ describe('NonZeroInt16', () => {
157
160
 
158
161
  test('pow (with clamping)', () => {
159
162
  const result = NonZeroInt16.pow(asNonZeroInt16(200), asNonZeroInt16(3));
163
+
160
164
  expect(result).toBe(32_767); // clamped to max
161
165
  expect(NonZeroInt16.pow(asNonZeroInt16(2), asNonZeroInt16(3))).toBe(8);
162
166
  });
@@ -169,6 +173,7 @@ describe('NonZeroInt16', () => {
169
173
 
170
174
  for (const _ of range(10)) {
171
175
  const result = NonZeroInt16.random(min, max);
176
+
172
177
  expect(result).toBeGreaterThanOrEqual(min);
173
178
  expect(result).toBeLessThanOrEqual(max);
174
179
  expect(NonZeroInt16.is(result)).toBe(true);
@@ -180,6 +185,7 @@ describe('NonZeroInt16', () => {
180
185
  test('generates values within NonZeroInt16 range', () => {
181
186
  for (const _ of range(10)) {
182
187
  const result = NonZeroInt16.random(-20, 20);
188
+
183
189
  expect(result).toBeGreaterThanOrEqual(-32_768);
184
190
  expect(result).toBeLessThanOrEqual(32_767);
185
191
  }
@@ -6,8 +6,8 @@ import {
6
6
  NonZeroInt32,
7
7
  } from './non-zero-int32.mjs';
8
8
 
9
- describe('NonZeroInt32', () => {
10
- describe('asNonZeroInt32', () => {
9
+ describe('NonZeroInt32 test', () => {
10
+ describe(asNonZeroInt32, () => {
11
11
  test('accepts valid non-zero int32 values', () => {
12
12
  expect(() => asNonZeroInt32(1)).not.toThrow();
13
13
  expect(() => asNonZeroInt32(-1)).not.toThrow();
@@ -62,7 +62,7 @@ describe('NonZeroInt32', () => {
62
62
  );
63
63
  });
64
64
 
65
- describe('isNonZeroInt32', () => {
65
+ describe(isNonZeroInt32, () => {
66
66
  test('correctly identifies non-zero int32 values', () => {
67
67
  expect(isNonZeroInt32(1)).toBe(true);
68
68
  expect(isNonZeroInt32(-1)).toBe(true);
@@ -127,6 +127,7 @@ describe('NonZeroInt32', () => {
127
127
  asNonZeroInt32(2_147_483_000),
128
128
  asNonZeroInt32(1000),
129
129
  );
130
+
130
131
  expect(result).toBe(2_147_483_647); // clamped to max
131
132
  expect(NonZeroInt32.add(a, b)).toBe(1_500_000);
132
133
  });
@@ -136,6 +137,7 @@ describe('NonZeroInt32', () => {
136
137
  asNonZeroInt32(-2_147_483_000),
137
138
  asNonZeroInt32(1000),
138
139
  );
140
+
139
141
  expect(result).toBe(-2_147_483_648); // clamped to min
140
142
  expect(NonZeroInt32.sub(a, b)).toBe(500_000);
141
143
  });
@@ -145,6 +147,7 @@ describe('NonZeroInt32', () => {
145
147
  asNonZeroInt32(100_000),
146
148
  asNonZeroInt32(100_000),
147
149
  );
150
+
148
151
  expect(result).toBe(2_147_483_647); // clamped to max
149
152
  expect(NonZeroInt32.mul(asNonZeroInt32(1000), asNonZeroInt32(5))).toBe(
150
153
  5000,
@@ -162,6 +165,7 @@ describe('NonZeroInt32', () => {
162
165
  asNonZeroInt32(10_000),
163
166
  asNonZeroInt32(3),
164
167
  );
168
+
165
169
  expect(result).toBe(2_147_483_647); // clamped to max
166
170
  expect(NonZeroInt32.pow(asNonZeroInt32(2), asNonZeroInt32(3))).toBe(8);
167
171
  });
@@ -174,6 +178,7 @@ describe('NonZeroInt32', () => {
174
178
 
175
179
  for (const _ of range(10)) {
176
180
  const result = NonZeroInt32.random(min, max);
181
+
177
182
  expect(result).toBeGreaterThanOrEqual(min);
178
183
  expect(result).toBeLessThanOrEqual(max);
179
184
  expect(NonZeroInt32.is(result)).toBe(true);
@@ -185,6 +190,7 @@ describe('NonZeroInt32', () => {
185
190
  test('generates values within NonZeroInt32 range', () => {
186
191
  for (const _ of range(10)) {
187
192
  const result = NonZeroInt32.random(-20, 20);
193
+
188
194
  expect(result).toBeGreaterThanOrEqual(-2_147_483_648);
189
195
  expect(result).toBeLessThanOrEqual(2_147_483_647);
190
196
  }
@@ -6,8 +6,8 @@ import {
6
6
  NonZeroSafeInt,
7
7
  } from './non-zero-safe-int.mjs';
8
8
 
9
- describe('NonZeroSafeInt', () => {
10
- describe('asNonZeroSafeInt', () => {
9
+ describe('NonZeroSafeInt test', () => {
10
+ describe(asNonZeroSafeInt, () => {
11
11
  test('accepts valid non-zero safe integers', () => {
12
12
  expect(() => asNonZeroSafeInt(1)).not.toThrow();
13
13
  expect(() => asNonZeroSafeInt(-1)).not.toThrow();
@@ -68,7 +68,7 @@ describe('NonZeroSafeInt', () => {
68
68
  );
69
69
  });
70
70
 
71
- describe('isNonZeroSafeInt', () => {
71
+ describe(isNonZeroSafeInt, () => {
72
72
  test('correctly identifies non-zero safe integers', () => {
73
73
  expect(isNonZeroSafeInt(1)).toBe(true);
74
74
  expect(isNonZeroSafeInt(-1)).toBe(true);
@@ -135,6 +135,7 @@ describe('NonZeroSafeInt', () => {
135
135
  test('add (with clamping to safe integer range)', () => {
136
136
  const largeValue = asNonZeroSafeInt(Number.MAX_SAFE_INTEGER - 1);
137
137
  const result = NonZeroSafeInt.add(largeValue, asNonZeroSafeInt(10));
138
+
138
139
  expect(result).toBe(Number.MAX_SAFE_INTEGER); // clamped to max
139
140
  expect(NonZeroSafeInt.add(a, b)).toBe(7);
140
141
  });
@@ -142,6 +143,7 @@ describe('NonZeroSafeInt', () => {
142
143
  test('sub (with clamping to safe integer range)', () => {
143
144
  const smallValue = asNonZeroSafeInt(Number.MIN_SAFE_INTEGER + 1);
144
145
  const result = NonZeroSafeInt.sub(smallValue, asNonZeroSafeInt(10));
146
+
145
147
  expect(result).toBe(Number.MIN_SAFE_INTEGER); // clamped to min
146
148
  expect(NonZeroSafeInt.sub(a, b)).toBe(3);
147
149
  });
@@ -151,6 +153,7 @@ describe('NonZeroSafeInt', () => {
151
153
  Math.floor(Math.sqrt(Number.MAX_SAFE_INTEGER)),
152
154
  );
153
155
  const result = NonZeroSafeInt.mul(largeValue, largeValue);
156
+
154
157
  expect(result).toBeLessThanOrEqual(Number.MAX_SAFE_INTEGER);
155
158
  expect(
156
159
  NonZeroSafeInt.mul(asNonZeroSafeInt(10), asNonZeroSafeInt(5)),
@@ -172,6 +175,7 @@ describe('NonZeroSafeInt', () => {
172
175
  asNonZeroSafeInt(1000),
173
176
  asNonZeroSafeInt(10),
174
177
  );
178
+
175
179
  expect(result).toBe(Number.MAX_SAFE_INTEGER); // clamped to max
176
180
  expect(NonZeroSafeInt.pow(asNonZeroSafeInt(2), asNonZeroSafeInt(3))).toBe(
177
181
  8,
@@ -186,6 +190,7 @@ describe('NonZeroSafeInt', () => {
186
190
 
187
191
  for (const _ of range(10)) {
188
192
  const result = NonZeroSafeInt.random(min, max);
193
+
189
194
  expect(result).toBeGreaterThanOrEqual(min);
190
195
  expect(result).toBeLessThanOrEqual(max);
191
196
  expect(NonZeroSafeInt.is(result)).toBe(true);
@@ -200,6 +205,7 @@ describe('NonZeroSafeInt', () => {
200
205
 
201
206
  for (const _ of range(10)) {
202
207
  const result = NonZeroSafeInt.random(min, max);
208
+
203
209
  expect(result).toBeGreaterThanOrEqual(min);
204
210
  expect(result).toBeLessThanOrEqual(max);
205
211
  expect(NonZeroSafeInt.is(result)).toBe(true);
@@ -214,6 +220,7 @@ describe('NonZeroSafeInt', () => {
214
220
 
215
221
  for (const _ of range(10)) {
216
222
  const result = NonZeroSafeInt.random(min, max);
223
+
217
224
  expect(result).toBeGreaterThanOrEqual(min);
218
225
  expect(result).toBeLessThanOrEqual(max);
219
226
  expect(NonZeroSafeInt.is(result)).toBe(true);
@@ -6,8 +6,8 @@ import {
6
6
  NonZeroUint16,
7
7
  } from './non-zero-uint16.mjs';
8
8
 
9
- describe('NonZeroUint16', () => {
10
- describe('asNonZeroUint16', () => {
9
+ describe('NonZeroUint16 test', () => {
10
+ describe(asNonZeroUint16, () => {
11
11
  test('accepts valid non-zero uint16 values', () => {
12
12
  expect(() => asNonZeroUint16(1)).not.toThrow();
13
13
  expect(() => asNonZeroUint16(1000)).not.toThrow();
@@ -68,7 +68,7 @@ describe('NonZeroUint16', () => {
68
68
  );
69
69
  });
70
70
 
71
- describe('isNonZeroUint16', () => {
71
+ describe(isNonZeroUint16, () => {
72
72
  test('correctly identifies non-zero uint16 values', () => {
73
73
  expect(isNonZeroUint16(1)).toBe(true);
74
74
  expect(isNonZeroUint16(1000)).toBe(true);
@@ -128,6 +128,7 @@ describe('NonZeroUint16', () => {
128
128
  asNonZeroUint16(65_000),
129
129
  asNonZeroUint16(1000),
130
130
  );
131
+
131
132
  expect(result).toBe(65_535); // clamped to max
132
133
  expect(NonZeroUint16.add(a, b)).toBe(150);
133
134
  });
@@ -142,6 +143,7 @@ describe('NonZeroUint16', () => {
142
143
  asNonZeroUint16(1000),
143
144
  asNonZeroUint16(100),
144
145
  );
146
+
145
147
  expect(result).toBe(65_535); // clamped to max
146
148
  expect(NonZeroUint16.mul(asNonZeroUint16(10), asNonZeroUint16(5))).toBe(
147
149
  50,
@@ -161,6 +163,7 @@ describe('NonZeroUint16', () => {
161
163
  asNonZeroUint16(256),
162
164
  asNonZeroUint16(3),
163
165
  );
166
+
164
167
  expect(result).toBe(65_535); // clamped to max
165
168
  expect(NonZeroUint16.pow(asNonZeroUint16(2), asNonZeroUint16(3))).toBe(8);
166
169
  });
@@ -173,6 +176,7 @@ describe('NonZeroUint16', () => {
173
176
 
174
177
  for (const _ of range(10)) {
175
178
  const result = NonZeroUint16.random(min, max);
179
+
176
180
  expect(result).toBeGreaterThanOrEqual(min);
177
181
  expect(result).toBeLessThanOrEqual(max);
178
182
  expect(NonZeroUint16.is(result)).toBe(true);
@@ -184,6 +188,7 @@ describe('NonZeroUint16', () => {
184
188
  test('generates values within NonZeroUint16 range', () => {
185
189
  for (const _ of range(10)) {
186
190
  const result = NonZeroUint16.random(1, 30);
191
+
187
192
  expect(result).toBeGreaterThanOrEqual(1);
188
193
  expect(result).toBeLessThanOrEqual(65_535);
189
194
  }