diff --git a/package.json b/package.json index 069740b..07cb8cf 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ }, "devDependencies": { "@changesets/cli": "2.26.2", - "@types/node": "20.3.2", - "tsup": "7.1.0", - "typescript": "5.1.6", - "vitest": "0.32.2" + "@types/node": "20.5.7", + "tsup": "7.2.0", + "typescript": "5.2.2", + "vitest": "0.34.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f39771e..18e0bd7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,17 +9,17 @@ devDependencies: specifier: 2.26.2 version: 2.26.2 '@types/node': - specifier: 20.3.2 - version: 20.3.2 + specifier: 20.5.7 + version: 20.5.7 tsup: - specifier: 7.1.0 - version: 7.1.0(typescript@5.1.6) + specifier: 7.2.0 + version: 7.2.0(typescript@5.2.2) typescript: - specifier: 5.1.6 - version: 5.1.6 + specifier: 5.2.2 + version: 5.2.2 vitest: - specifier: 0.32.2 - version: 0.32.2 + specifier: 0.34.3 + version: 0.34.3 packages: @@ -631,6 +631,13 @@ packages: dev: true optional: true + /@jest/schemas@29.6.3: + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@sinclair/typebox': 0.27.8 + dev: true + /@jridgewell/gen-mapping@0.3.3: resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} engines: {node: '>=6.0.0'} @@ -706,6 +713,10 @@ packages: fastq: 1.15.0 dev: true + /@sinclair/typebox@0.27.8: + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true + /@types/chai-subset@1.3.3: resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} dependencies: @@ -730,8 +741,8 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: true - /@types/node@20.3.2: - resolution: {integrity: sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw==} + /@types/node@20.5.7: + resolution: {integrity: sha512-dP7f3LdZIysZnmvP3ANJYTSwg+wLLl8p7RqniVlV7j+oXSXAbt9h0WIBFmJy5inWZoX9wZN6eXx+YXd9Rh3RBA==} dev: true /@types/normalize-package-data@2.4.1: @@ -742,43 +753,42 @@ packages: resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} dev: true - /@vitest/expect@0.32.2: - resolution: {integrity: sha512-6q5yzweLnyEv5Zz1fqK5u5E83LU+gOMVBDuxBl2d2Jfx1BAp5M+rZgc5mlyqdnxquyoiOXpXmFNkcGcfFnFH3Q==} + /@vitest/expect@0.34.3: + resolution: {integrity: sha512-F8MTXZUYRBVsYL1uoIft1HHWhwDbSzwAU9Zgh8S6WFC3YgVb4AnFV2GXO3P5Em8FjEYaZtTnQYoNwwBrlOMXgg==} dependencies: - '@vitest/spy': 0.32.2 - '@vitest/utils': 0.32.2 + '@vitest/spy': 0.34.3 + '@vitest/utils': 0.34.3 chai: 4.3.7 dev: true - /@vitest/runner@0.32.2: - resolution: {integrity: sha512-06vEL0C1pomOEktGoLjzZw+1Fb+7RBRhmw/06WkDrd1akkT9i12su0ku+R/0QM69dfkIL/rAIDTG+CSuQVDcKw==} + /@vitest/runner@0.34.3: + resolution: {integrity: sha512-lYNq7N3vR57VMKMPLVvmJoiN4bqwzZ1euTW+XXYH5kzr3W/+xQG3b41xJn9ChJ3AhYOSoweu974S1V3qDcFESA==} dependencies: - '@vitest/utils': 0.32.2 - concordance: 5.0.4 + '@vitest/utils': 0.34.3 p-limit: 4.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@0.32.2: - resolution: {integrity: sha512-JwhpeH/PPc7GJX38vEfCy9LtRzf9F4er7i4OsAJyV7sjPwjj+AIR8cUgpMTWK4S3TiamzopcTyLsZDMuldoi5A==} + /@vitest/snapshot@0.34.3: + resolution: {integrity: sha512-QyPaE15DQwbnIBp/yNJ8lbvXTZxS00kRly0kfFgAD5EYmCbYcA+1EEyRalc93M0gosL/xHeg3lKAClIXYpmUiQ==} dependencies: - magic-string: 0.30.0 + magic-string: 0.30.3 pathe: 1.1.1 - pretty-format: 27.5.1 + pretty-format: 29.6.3 dev: true - /@vitest/spy@0.32.2: - resolution: {integrity: sha512-Q/ZNILJ4ca/VzQbRM8ur3Si5Sardsh1HofatG9wsJY1RfEaw0XKP8IVax2lI1qnrk9YPuG9LA2LkZ0EI/3d4ug==} + /@vitest/spy@0.34.3: + resolution: {integrity: sha512-N1V0RFQ6AI7CPgzBq9kzjRdPIgThC340DGjdKdPSE8r86aUSmeliTUgkTqLSgtEwWWsGfBQ+UetZWhK0BgJmkQ==} dependencies: tinyspy: 2.1.1 dev: true - /@vitest/utils@0.32.2: - resolution: {integrity: sha512-lnJ0T5i03j0IJaeW73hxe2AuVnZ/y1BhhCOuIcl9LIzXnbpXJT9Lrt6brwKHXLOiA7MZ6N5hSJjt0xE1dGNCzQ==} + /@vitest/utils@0.34.3: + resolution: {integrity: sha512-kiSnzLG6m/tiT0XEl4U2H8JDBjFtwVlaE8I3QfGiMFR0QvnRDfYfdP3YvTBWM/6iJDAyaPY6yVQiCTUc7ZzTHA==} dependencies: diff-sequences: 29.4.3 loupe: 2.3.6 - pretty-format: 27.5.1 + pretty-format: 29.6.3 dev: true /acorn-walk@8.2.0: @@ -786,8 +796,8 @@ packages: engines: {node: '>=0.4.0'} dev: true - /acorn@8.8.2: - resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} + /acorn@8.10.0: + resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -891,10 +901,6 @@ packages: engines: {node: '>=8'} dev: true - /blueimp-md5@2.19.0: - resolution: {integrity: sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==} - dev: true - /brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: @@ -1061,20 +1067,6 @@ packages: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true - /concordance@5.0.4: - resolution: {integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==} - engines: {node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'} - dependencies: - date-time: 3.1.0 - esutils: 2.0.3 - fast-diff: 1.3.0 - js-string-escape: 1.0.1 - lodash: 4.17.21 - md5-hex: 3.0.1 - semver: 7.5.3 - well-known-symbols: 2.0.0 - dev: true - /cross-spawn@5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} dependencies: @@ -1114,13 +1106,6 @@ packages: stream-transform: 2.1.3 dev: true - /date-time@3.1.0: - resolution: {integrity: sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==} - engines: {node: '>=6'} - dependencies: - time-zone: 1.0.0 - dev: true - /debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -1341,11 +1326,6 @@ packages: hasBin: true dev: true - /esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - dev: true - /execa@5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} @@ -1374,10 +1354,6 @@ packages: tmp: 0.0.33 dev: true - /fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: true - /fast-glob@3.2.12: resolution: {integrity: sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==} engines: {node: '>=8.6.0'} @@ -1828,11 +1804,6 @@ packages: engines: {node: '>=10'} dev: true - /js-string-escape@1.0.1: - resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} - engines: {node: '>= 0.8'} - dev: true - /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true @@ -1920,10 +1891,6 @@ packages: resolution: {integrity: sha512-+WKqsK294HMSc2jEbNgpHpd0JfIBhp7rEV4aqXWqFr6AlXov+SlcgB1Fv01y2kGe3Gc8nMW7VA0SrGuSkRfIEg==} dev: true - /lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: true - /loupe@2.3.6: resolution: {integrity: sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==} dependencies: @@ -1944,8 +1911,8 @@ packages: yallist: 4.0.0 dev: true - /magic-string@0.30.0: - resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==} + /magic-string@0.30.3: + resolution: {integrity: sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==} engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 @@ -1961,13 +1928,6 @@ packages: engines: {node: '>=8'} dev: true - /md5-hex@3.0.1: - resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} - engines: {node: '>=8'} - dependencies: - blueimp-md5: 2.19.0 - dev: true - /meow@6.1.1: resolution: {integrity: sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==} engines: {node: '>=8'} @@ -2032,13 +1992,13 @@ packages: engines: {node: '>= 8.0.0'} dev: true - /mlly@1.3.0: - resolution: {integrity: sha512-HT5mcgIQKkOrZecOjOX3DJorTikWXwsBfpcr/MGBkhfWcjiqvnaL/9ppxvIUXfjT6xt4DVIAsN9fMUz1ev4bIw==} + /mlly@1.4.1: + resolution: {integrity: sha512-SCDs78Q2o09jiZiE2WziwVBEqXQ02XkGdUy45cbJf+BpYRIjArXRJ1Wbowxkb+NaM9DWvS3UC9GiO/6eqvQ/pg==} dependencies: - acorn: 8.8.2 + acorn: 8.10.0 pathe: 1.1.1 pkg-types: 1.0.3 - ufo: 1.1.2 + ufo: 1.3.0 dev: true /ms@2.1.2: @@ -2250,7 +2210,7 @@ packages: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: jsonc-parser: 3.2.0 - mlly: 1.3.0 + mlly: 1.4.1 pathe: 1.1.1 dev: true @@ -2295,13 +2255,13 @@ packages: hasBin: true dev: true - /pretty-format@27.5.1: - resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} - engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + /pretty-format@29.6.3: + resolution: {integrity: sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - ansi-regex: 5.0.1 + '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 - react-is: 17.0.2 + react-is: 18.2.0 dev: true /pseudomap@1.0.2: @@ -2322,8 +2282,8 @@ packages: engines: {node: '>=8'} dev: true - /react-is@17.0.2: - resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + /react-is@18.2.0: + resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} dev: true /read-pkg-up@7.0.1: @@ -2632,7 +2592,7 @@ packages: /strip-literal@1.0.1: resolution: {integrity: sha512-QZTsipNpa2Ppr6v1AmJHESqJ3Uz247MUS0OjrnnZjFAvEoWqxuyFuXn2xLgMtRnijJShAa1HL0gtJyUs7u7n3Q==} dependencies: - acorn: 8.8.2 + acorn: 8.10.0 dev: true /sucrase@3.32.0: @@ -2686,17 +2646,12 @@ packages: any-promise: 1.3.0 dev: true - /time-zone@1.0.0: - resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} - engines: {node: '>=4'} - dev: true - /tinybench@2.5.0: resolution: {integrity: sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==} dev: true - /tinypool@0.5.0: - resolution: {integrity: sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==} + /tinypool@0.7.0: + resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} engines: {node: '>=14.0.0'} dev: true @@ -2739,8 +2694,8 @@ packages: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: true - /tsup@7.1.0(typescript@5.1.6): - resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==} + /tsup@7.2.0(typescript@5.2.2): + resolution: {integrity: sha512-vDHlczXbgUvY3rWvqFEbSqmC1L7woozbzngMqTtL2PGBODTtWlRwGDDawhvWzr5c1QjKe4OAKqJGfE1xeXUvtQ==} engines: {node: '>=16.14'} hasBin: true peerDependencies: @@ -2769,7 +2724,7 @@ packages: source-map: 0.8.0-beta.0 sucrase: 3.32.0 tree-kill: 1.2.2 - typescript: 5.1.6 + typescript: 5.2.2 transitivePeerDependencies: - supports-color - ts-node @@ -2817,14 +2772,14 @@ packages: is-typed-array: 1.1.10 dev: true - /typescript@5.1.6: - resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true dev: true - /ufo@1.1.2: - resolution: {integrity: sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==} + /ufo@1.3.0: + resolution: {integrity: sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==} dev: true /unbox-primitive@1.0.2: @@ -2848,17 +2803,17 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@0.32.2(@types/node@20.3.2): - resolution: {integrity: sha512-dTQ1DCLwl2aEseov7cfQ+kDMNJpM1ebpyMMMwWzBvLbis8Nla/6c9WQcqpPssTwS6Rp/+U6KwlIj8Eapw4bLdA==} + /vite-node@0.34.3(@types/node@20.5.7): + resolution: {integrity: sha512-+0TzJf1g0tYXj6tR2vEyiA42OPq68QkRZCu/ERSo2PtsDJfBpDyEfuKbRvLmZqi/CgC7SCBtyC+WjTGNMRIaig==} engines: {node: '>=v14.18.0'} hasBin: true dependencies: cac: 6.7.14 debug: 4.3.4 - mlly: 1.3.0 + mlly: 1.4.1 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.0.3(@types/node@20.3.2) + vite: 4.0.3(@types/node@20.5.7) transitivePeerDependencies: - '@types/node' - less @@ -2869,7 +2824,7 @@ packages: - terser dev: true - /vite@4.0.3(@types/node@20.3.2): + /vite@4.0.3(@types/node@20.5.7): resolution: {integrity: sha512-HvuNv1RdE7deIfQb8mPk51UKjqptO/4RXZ5yXSAvurd5xOckwS/gg8h9Tky3uSbnjYTgUm0hVCet1cyhKd73ZA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -2894,7 +2849,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.3.2 + '@types/node': 20.5.7 esbuild: 0.16.7 postcss: 8.4.20 resolve: 1.22.1 @@ -2903,8 +2858,8 @@ packages: fsevents: 2.3.2 dev: true - /vitest@0.32.2: - resolution: {integrity: sha512-hU8GNNuQfwuQmqTLfiKcqEhZY72Zxb7nnN07koCUNmntNxbKQnVbeIS6sqUgR3eXSlbOpit8+/gr1KpqoMgWCQ==} + /vitest@0.34.3: + resolution: {integrity: sha512-7+VA5Iw4S3USYk+qwPxHl8plCMhA5rtfwMjgoQXMT7rO5ldWcdsdo3U1QD289JgglGK4WeOzgoLTsGFu6VISyQ==} engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: @@ -2936,28 +2891,27 @@ packages: dependencies: '@types/chai': 4.3.5 '@types/chai-subset': 1.3.3 - '@types/node': 20.3.2 - '@vitest/expect': 0.32.2 - '@vitest/runner': 0.32.2 - '@vitest/snapshot': 0.32.2 - '@vitest/spy': 0.32.2 - '@vitest/utils': 0.32.2 - acorn: 8.8.2 + '@types/node': 20.5.7 + '@vitest/expect': 0.34.3 + '@vitest/runner': 0.34.3 + '@vitest/snapshot': 0.34.3 + '@vitest/spy': 0.34.3 + '@vitest/utils': 0.34.3 + acorn: 8.10.0 acorn-walk: 8.2.0 cac: 6.7.14 chai: 4.3.7 - concordance: 5.0.4 debug: 4.3.4 local-pkg: 0.4.3 - magic-string: 0.30.0 + magic-string: 0.30.3 pathe: 1.1.1 picocolors: 1.0.0 std-env: 3.3.3 strip-literal: 1.0.1 tinybench: 2.5.0 - tinypool: 0.5.0 - vite: 4.0.3(@types/node@20.3.2) - vite-node: 0.32.2(@types/node@20.3.2) + tinypool: 0.7.0 + vite: 4.0.3(@types/node@20.5.7) + vite-node: 0.34.3(@types/node@20.5.7) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -2978,11 +2932,6 @@ packages: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} dev: true - /well-known-symbols@2.0.0: - resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} - engines: {node: '>=6'} - dev: true - /whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} dependencies: diff --git a/test/interpolation.test.ts b/test/interpolation.test.ts deleted file mode 100644 index ac75e83..0000000 --- a/test/interpolation.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { describe, expect, test } from 'vitest' -import { Eerp, Lerp, FastLerp } from '../src/utils/interpolation' - -describe('Interpolation', () => { - test('Eerp 28, 46, 1', () => { - const e = Eerp(28, 46, 1) - - expect(e).toBe(46) - }) - test('Eerp 28, 46, 0', () => { - const e = Eerp(28, 46, 0) - - expect(e).toBe(28) - }) - test('Eerp 28, 46, -1', () => { - const e = Eerp(28, 46, -1) - - expect(parseFloat(e.toFixed(3))).toBe(17.043) - }) - test('Lerp 28, 46, -1', () => { - const e = Lerp(28, 46, -1) - - expect(e).toBe(10) - }) - test('fastLerp 28, 46, -1', () => { - const e = FastLerp(28, 46, -1) - - expect(e).toBe(10) - }) - // test('Eerps 28, 46, 1', () => { - // const e = Eerps(28, 46, 1) - - // expect(e).toBe(46) - // }) - // test('Eerps 28, 46, 0', () => { - // const e = Eerps(28, 46, 0) - - // expect(e).toBe(28) - // }) - // test('Eerps 28, 46, -1', () => { - // const e = Eerps(28, 46, -1) - - // expect(parseFloat(e.toFixed(3))).toBe(17.043) - // }) - // test('Eerp vs Eerps', () => { - // const e1 = Eerp(28, 46, 1) - // const e2 = Eerps(28, 46, 1) - // let rad: boolean - // if (e1 === e2) { - // rad = true - // } else { - // rad = false - // } - // expect(rad).toBe(true) - // }) - -}) \ No newline at end of file diff --git a/test/mat4.test.ts b/test/mat4.test.ts index d7acb9c..7884db9 100644 --- a/test/mat4.test.ts +++ b/test/mat4.test.ts @@ -1,53 +1,28 @@ import { describe, expect, test } from 'vitest' -import { mat4 } from '../src' +import { Mat4 } from '../src/Mat4' +import { Vec4 } from '../src/vec4' describe('Mat4', () => { test('create, no values given default to [0, 0, 0, 0, 0, 0, 0, 0, 0]', () => { - const mat = mat4.create() - expect(mat[0]).toBe(1) - expect(mat[1]).toBe(0) - expect(mat[2]).toBe(0) - expect(mat[3]).toBe(0) + const mat = new Mat4(new Vec4(), new Vec4(), new Vec4(), new Vec4()) + expect(mat.m00).toBe(1) + expect(mat.m10).toBe(0) + expect(mat.m20).toBe(0) + expect(mat.m30).toBe(0) - expect(mat[4]).toBe(0) - expect(mat[5]).toBe(1) - expect(mat[6]).toBe(0) - expect(mat[7]).toBe(0) + expect(mat.m01).toBe(0) + expect(mat.m11).toBe(1) + expect(mat.m21).toBe(0) + expect(mat.m31).toBe(0) - expect(mat[8]).toBe(0) - expect(mat[9]).toBe(0) - expect(mat[10]).toBe(1) - expect(mat[11]).toBe(0) + expect(mat.m02).toBe(0) + expect(mat.m12).toBe(0) + expect(mat.m22).toBe(1) + expect(mat.m32).toBe(0) - expect(mat[12]).toBe(0) - expect(mat[13]).toBe(0) - expect(mat[14]).toBe(0) - expect(mat[15]).toBe(1) + expect(mat.m03).toBe(0) + expect(mat.m13).toBe(0) + expect(mat.m23).toBe(0) + expect(mat.m33).toBe(1) }) - test('create, [0, 1, 0, 0, 0, 1, 0, 1, 0] values given', () => { - const mat = mat4.create( - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 1, 0, 0, - 0, 0, 1, 0) - expect(mat[0]).toBe(0) - expect(mat[1]).toBe(1) - expect(mat[2]).toBe(0) - expect(mat[3]).toBe(0) - - expect(mat[4]).toBe(0) - expect(mat[5]).toBe(0) - expect(mat[6]).toBe(1) - expect(mat[7]).toBe(0) - - expect(mat[8]).toBe(0) - expect(mat[9]).toBe(1) - expect(mat[10]).toBe(0) - expect(mat[11]).toBe(0) - - expect(mat[12]).toBe(0) - expect(mat[13]).toBe(0) - expect(mat[14]).toBe(1) - expect(mat[15]).toBe(0) - }) -}) \ No newline at end of file +}) diff --git a/test/mathOperation.test.ts b/test/mathOperation.test.ts deleted file mode 100644 index 02a6d33..0000000 --- a/test/mathOperation.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, test } from 'vitest' -import * as vec2 from '../src/vec2' -import * as vec3 from '../src/vec3' -import * as vec4 from '../src/vec4' -import { Sqrt, Sqrt2, Sqrt3, Sqrt4 } from '../src/utils/mathOperation' - -describe('Squared', () => { - test('squirt overload, return{number}', () => { - const rad = Sqrt(1403) - - expect(rad).toBe(37.456641600656084) - }) - test('squirt overload, return{number}', () => { - const vec = vec2.create(7443, 2463) - const rad = Sqrt2(vec) - - expect(parseFloat(rad[0].toFixed(3))).toBe(86.273) - expect(parseFloat(rad[1].toFixed(3))).toBe(49.629) - }) - test('squirt overload, return{vec3}', () => { - const vec = vec3.create(7443, 2463, 61093) - const rad = Sqrt3(vec) - expect(parseFloat(rad[0].toFixed(3))).toBe(86.273) - expect(parseFloat(rad[1].toFixed(3))).toBe(49.629) - expect(parseFloat(rad[2].toFixed(3))).toBe(247.170) - }) - test('squirt overload, return{vec4}', () => { - const vec = vec4.create(14403, 2903, 1435, 44159) - const rad = Sqrt4(vec) - expect(parseFloat(rad[0].toFixed(3))).toBe(120.012) - expect(parseFloat(rad[1].toFixed(3))).toBe(53.879) - expect(parseFloat(rad[2].toFixed(3))).toBe(37.881) - expect(parseFloat(rad[3].toFixed(3))).toBe(210.140) - }) - test('bitwise shift and or operator', () => { - let a = 0b101 - let b = 0b10110 - b <<= 4 // 0001 0110 0000 = 357 - let c = a | b - expect(c.toString(2)).toBe('101100101') - }) - test('bitwise xor operator', () => { - let a = ~0b00010000 - let b = 0b101100101 - let c = a & b - expect(c.toString(2)).toBe('101100101') - }) - test('bitwise not operator', () => { - let a = 0b1101 - let b = a ^ a - - expect(b).toBe(0) - }) -}) \ No newline at end of file diff --git a/test/quat.test.ts b/test/quat.test.ts index a79e4d1..5b34d0c 100644 --- a/test/quat.test.ts +++ b/test/quat.test.ts @@ -1,89 +1,35 @@ import { describe, expect, test } from 'vitest' -import { quat } from "../src" -// import { benchmark } from '../benchmark/benchmark' +import { Quaternion } from "../src/Quat" -describe('quat', () => { +describe('Quaternion', () => { test('create, no values given', () => { - const v = quat.create() - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - expect(v[3]).toBe(0) - }) - test('create, 1,2,3,4 values given', () => { - const v = quat.create(1, 2, 3, 4) - expect(v[0]).toBe(1) - expect(v[1]).toBe(2) - expect(v[2]).toBe(3) - expect(v[3]).toBe(4) - }) - test('Normalize, Quaternion(3,1,2,4) values given', () => { - const v = quat.create(3, 1, 2, 4) - const norm = quat.Normalize(v) - expect(parseFloat(norm[0].toFixed(3))).toBe(0.548) - expect(parseFloat(norm[1].toFixed(3))).toBe(0.183) - expect(parseFloat(norm[2].toFixed(3))).toBe(0.365) - expect(parseFloat(norm[3].toFixed(3))).toBe(0.730) - }) - test('conjugate', () => { - const v = quat.create(3, 1, 2, 4) - const con = quat.Conjugate(v) - expect(con[0]).toBe(-3) - expect(con[1]).toBe(-1) - expect(con[2]).toBe(-2) - expect(con[3]).toBe(4) - }) - test('inverse', () => { - const v = quat.create(3, 1, 2, 4) - const inv = quat.Inverse(v) - // const sa = benchmark(() => inv, null, 100) - // console.log('inverse', sa); - expect(inv[0]).toBe(-0.10000000149011612) - expect(inv[1]).toBe(-0.03333333507180214) - expect(inv[2]).toBe(-0.06666667014360428) - expect(inv[3]).toBe(0.13333334028720856) - }) - test('inverse', () => { - const v = quat.create(3, 1, 2, 4) - const inv = quat.Inverses(v) - // const sa = benchmark(() => inv, null, 100) - // console.log('inverses', sa); - expect(inv[0]).toBe(-0.547722578048706) - expect(inv[1]).toBe(-0.18257418274879456) - expect(inv[2]).toBe(-0.3651483654975891) - expect(inv[3]).toBe(0.7302967309951782) - }) - test('inverse', () => { - const v = quat.create(3, 1, 2, 4) - const inv = quat.Inversef(v) - // const sa = benchmark(() => inv, null, 100) - // console.log('inversef', sa); - expect(inv[0]).toBe(-90) - expect(inv[1]).toBe(-30) - expect(inv[2]).toBe(-60) - expect(inv[3]).toBe(120) - }) - test('to Matrix', () => { - const v = quat.create(3, 1, 2, 4) - const mat = quat.toMatrix(v) - expect(mat[0]).toBe(-9) - expect(mat[1]).toBe(-10) - expect(mat[2]).toBe(20) - expect(mat[3]).toBe(0) - - expect(mat[4]).toBe(22) - expect(mat[5]).toBe(-25) - expect(mat[6]).toBe(-20) - expect(mat[7]).toBe(0) - - expect(mat[8]).toBe(4) - expect(mat[9]).toBe(28) - expect(mat[10]).toBe(-19) - expect(mat[11]).toBe(0) - - expect(mat[12]).toBe(0) - expect(mat[13]).toBe(0) - expect(mat[14]).toBe(0) - expect(mat[15]).toBe(1) + const v = new Quaternion() + expect(v.x).toBe(0) + expect(v.y).toBe(0) + expect(v.z).toBe(0) + expect(v.w).toBe(1) + }) + test('create, 1,2,3,1 values given', () => { + const v = new Quaternion(1, 2, 3, 1) + expect(v.x).toBe(1) + expect(v.y).toBe(2) + expect(v.z).toBe(3) + expect(v.w).toBe(1) + }) + test('Normalize, Quaternion(3,1,2,1) values given', () => { + const quat = new Quaternion(3, 1, 2, 1) + const norm = quat.normalized + expect(parseFloat(norm.x.toFixed(3))).toBe(0.548) + expect(parseFloat(norm.y.toFixed(3))).toBe(0.183) + expect(parseFloat(norm.z.toFixed(3))).toBe(0.365) + expect(parseFloat(norm.w.toFixed(3))).toBe(0.730) + }) + test('Inverse', () => { + const quat = new Quaternion(3, 1, 2, 1) + const con = Quaternion.Inverse(quat) + expect(con.x).toBe(-3) + expect(con.y).toBe(-1) + expect(con.z).toBe(-2) + expect(con.w).toBe(1) }) }) diff --git a/test/vec2.test.ts b/test/vec2.test.ts index c3b4ae2..6a73a32 100644 --- a/test/vec2.test.ts +++ b/test/vec2.test.ts @@ -1,132 +1,39 @@ import { describe, expect, test } from 'vitest' -import { vec2 } from "../src" +import { Vec2 } from "../src/Vec2" describe('Vec2', () => { - test('create, no values given', () => { - const v = vec2.create() - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - }) - test('create, 1,2 values given', () => { - const v = vec2.create(1, 2) - expect(v[0]).toBe(1) - expect(v[1]).toBe(2) - }) - test('create, 1,2 values given', () => { - const v = vec2.down - - expect(v[0]).toBe(0) - expect(v[1]).toBe(-1) - }) - test('ScalarAddition, 1,2 values given', () => { - const v = vec2.create(1, 2) - const add = vec2.scalarAddition(v, 9) - expect(add[0]).toBe(10) - expect(add[1]).toBe(11) - }) - test('ScalarSubtraction, 1,2 values given', () => { - const v = vec2.create(1, 2) - const subtr = vec2.scalarSubtraction(v, 3) - expect(subtr[0]).toBe(-2) - expect(subtr[1]).toBe(-1) - }) - test('ScalarMultiplication, 1,2 values given', () => { - const v = vec2.create(1, 2) - const mult = vec2.scalarMultiplication(v, 3) - expect(mult[0]).toBe(3) - expect(mult[1]).toBe(6) - }) - test('ScalarDivision, 1,2 values given', () => { - const v = vec2.create(1, 2) - const div = vec2.scalarDivision(v, 1) - expect(div[0]).toBe(1) - expect(div[1]).toBe(2) - }) - test('add, 1,2 values given', () => { - const v1 = vec2.create(1, 2) - const v2 = vec2.create(1, 2) - const add = vec2.add(v1, v2) - expect(add[0]).toBe(2) - expect(add[1]).toBe(4) - }) - test('subtract, 1,2 values given', () => { - const v1 = vec2.create(1, 2) - const v2 = vec2.create(1, 2) - const subt = vec2.subtract(v1, v2) - expect(subt[0]).toBe(0) - expect(subt[1]).toBe(0) - }) - test('multiply, 1,2 values given', () => { - const v1 = vec2.create(1, 2) - const v2 = vec2.create(1, 2) - const mult = vec2.multiply(v1, v2) - expect(mult[0]).toBe(1) - expect(mult[1]).toBe(4) - }) - test('divide, 1,2 values given', () => { - const v1 = vec2.create(1, 2) - const v2 = vec2.create(1, 2) - const div = vec2.divide(v1, v2) - expect(div[0]).toBe(1) - expect(div[1]).toBe(1) - }) test('dot product', () => { - const v1 = vec2.create(9, 2) - const v2 = vec2.create(3, 7) - const dot = vec2.Dot(v1, v2) - expect(dot).toBe(21) + const v1 = new Vec2(9, 2) + const v2 = new Vec2(3, 7) + const dot = Vec2.Dot(v1, v2) + expect(dot).toBe(41) }) test('magnitude of vec(9,2)', () => { - const v = vec2.create(9, 2) - const mag = vec2.Magnitude(v) + const v = new Vec2(9, 2) + const mag = v.magnitude expect(parseFloat(mag.toFixed(3))).toBe(9.220) }) test('magnitudeSqrt of vec(9,2)', () => { - const v = vec2.create(9, 2) - const mag = vec2.SqrMagnitude(v) + const v = new Vec2(9, 2) + const mag = v.sqrMagnitude expect(mag).toBe(85) }) test('Normalized, v(3,1) values given', () => { - const v = vec2.create(3, 1) - const norm = vec2.normalized(v) - expect(parseFloat(norm[0].toFixed(3))).toBe(0.949) - expect(parseFloat(norm[1].toFixed(3))).toBe(0.316) + const v = new Vec2(3, 1) + const norm = v.normalize + expect(parseFloat(norm.x.toFixed(3))).toBe(0.949) + expect(parseFloat(norm.y.toFixed(3))).toBe(0.316) }) test('Negate, vec(2,-1)', () => { - const v = vec2.create(2, -1) - const neg = vec2.Negate(v) - expect(neg[0]).toBe(-2) - expect(neg[1]).toBe(1) - }) - test('Scalar Projection, v(2,3) values given', () => { - const v1 = vec2.create(2, 3) - const v2 = vec2.create(5, 7) - const scalProj = vec2.ScalarProjection(v1, v2) - expect(parseFloat(scalProj.toFixed(3))).toBe(13.387) - }) - test('Vector Projection, v(2,3) values given', () => { - const v1 = vec2.create(2, 3) - const v2 = vec2.create(5, 7) - const vecProj = vec2.VectorProjection(v1, v2) - expect(parseFloat(vecProj[0].toFixed(3))).toBe(7.426) - expect(parseFloat(vecProj[1].toFixed(3))).toBe(11.138) + const v = new Vec2(2, -1) + const neg = Vec2.negate(v) + expect(neg.x).toBe(-2) + expect(neg.y).toBe(1) }) test('Distance, v1(2,3) and v2(5,7) values given', () => { - const v1 = vec2.create(2, 3) - const v2 = vec2.create(5, 7) - const dist = vec2.Distance(v1, v2) + const v1 = new Vec2(2, 3) + const v2 = new Vec2(5, 7) + const dist = Vec2.Distance(v1, v2) expect(dist).toBe(5) }) - test('Distance Squared, v1(2,3) and v2(5,7) values given', () => { - const v1 = vec2.create(2, 3) - const v2 = vec2.create(5, 7) - const dist = vec2.SqrDistance(v1, v2) - expect(dist).toBe(25) - }) - test('ClampMagnitude', () => { - const v = vec2.create(53, 79) - const dist = vec2.ClampMagnitude(v, 2, 10) - expect(dist[0]).toBe(5.5712361335754395) - expect(dist[1]).toBe(8.304295539855957) - }) -}) \ No newline at end of file +}) diff --git a/test/vec3.test.ts b/test/vec3.test.ts index 415ed0f..de67814 100644 --- a/test/vec3.test.ts +++ b/test/vec3.test.ts @@ -1,94 +1,40 @@ import { describe, expect, test } from 'vitest' -import { vec3 } from "../src" +import { Vec3 } from "../src/Vec3" describe('Vec3', () => { test('create, no values given', () => { - const v = vec3.create() - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - }) - test('create, 1,2,3 values given', () => { - const v = vec3.create(1, 2, 3) - expect(v[0]).toBe(1) - expect(v[1]).toBe(2) - expect(v[2]).toBe(3) - }) - test('back static vector', () => { - const v = vec3.back - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(-1) - }) - test('forward static vector', () => { - const v = vec3.forward - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(1) - }) - test('down static vector', () => { - const v = vec3.down - expect(v[0]).toBe(0) - expect(v[1]).toBe(-1) - expect(v[2]).toBe(0) - }) - test('up static vector', () => { - const v = vec3.up - expect(v[0]).toBe(0) - expect(v[1]).toBe(1) - expect(v[2]).toBe(0) - }) - test('left static vector', () => { - const v = vec3.left - expect(v[0]).toBe(-1) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - }) - test('right static vector', () => { - const v = vec3.right - expect(v[0]).toBe(1) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - }) - test('one static vector', () => { - const v = vec3.one - expect(v[0]).toBe(1) - expect(v[1]).toBe(1) - expect(v[2]).toBe(1) - }) - test('zero static vector', () => { - const v = vec3.zero - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) + const v = new Vec3() + expect(v.x).toBe(0) + expect(v.y).toBe(0) + expect(v.z).toBe(0) }) test('Distance, v1(2,3,0) and v2(5,7,0) values given', () => { - const v1 = vec3.create(2, 3, 0) - const v2 = vec3.create(5, 7, 0) - const dist = vec3.distance(v1, v2) + const v1 = new Vec3(2, 3, 0) + const v2 = new Vec3(5, 7, 0) + const dist = Vec3.Distance(v1, v2) expect(dist).toBe(5) }) test('Normalized, v(3,1,2) values given', () => { - const v = vec3.create(3, 1, 2) - const norm = vec3.normalized(v) - expect(parseFloat(norm[0].toFixed(3))).toBe(0.802) - expect(parseFloat(norm[1].toFixed(3))).toBe(0.267) - expect(parseFloat(norm[2].toFixed(3))).toBe(0.535) + const v = new Vec3(3, 1, 2) + const norm = v.normalized + expect(parseFloat(norm.x.toFixed(3))).toBe(0.802) + expect(parseFloat(norm.y.toFixed(3))).toBe(0.267) + expect(parseFloat(norm.z.toFixed(3))).toBe(0.535) }) test('max', () => { - const v1 = vec3.create(6, 5, 8) - const v2 = vec3.create(5, 7, 1) - const max = vec3.max(v1, v2) - expect(max[0]).toBe(6) - expect(max[1]).toBe(7) - expect(max[2]).toBe(8) + const v1 = new Vec3(6, 5, 8) + const v2 = new Vec3(5, 7, 1) + const max = Vec3.Max(v1, v2) + expect(max.x).toBe(6) + expect(max.y).toBe(7) + expect(max.z).toBe(8) }) test('min', () => { - const v1 = vec3.create(6, 5, 8) - const v2 = vec3.create(5, 7, 1) - const max = vec3.min(v1, v2) - expect(max[0]).toBe(5) - expect(max[1]).toBe(5) - expect(max[2]).toBe(1) - }) -}) \ No newline at end of file + const v1 = new Vec3(6, 5, 8) + const v2 = new Vec3(5, 7, 1) + const max = Vec3.Min(v1, v2) + expect(max.x).toBe(5) + expect(max.y).toBe(5) + expect(max.z).toBe(1) + }) +}) diff --git a/test/vec4.test.ts b/test/vec4.test.ts index dbe27a2..727846d 100644 --- a/test/vec4.test.ts +++ b/test/vec4.test.ts @@ -1,56 +1,28 @@ import { describe, expect, test } from 'vitest' -import * as vec4 from "../src/vec4" +import { Vec4 } from "../src/vec4" describe('vec4', () => { - test('create, no values given', () => { - const v = vec4.create() - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - expect(v[3]).toBe(0) - }) - test('create, 1,2,3,4 values given', () => { - const v = vec4.create(1, 2, 3, 4) - expect(v[0]).toBe(1) - expect(v[1]).toBe(2) - expect(v[2]).toBe(3) - expect(v[3]).toBe(4) - }) - test('one static vector', () => { - const v = vec4.one - expect(v[0]).toBe(1) - expect(v[1]).toBe(1) - expect(v[2]).toBe(1) - expect(v[3]).toBe(1) - }) - test('zero static vector', () => { - const v = vec4.zero - expect(v[0]).toBe(0) - expect(v[1]).toBe(0) - expect(v[2]).toBe(0) - expect(v[3]).toBe(0) - }) test('Distance, v1(2,3,0,2) and v2(5,7,0,2) values given', () => { - const v1 = vec4.create(2, 3, 0, 2) - const v2 = vec4.create(5, 7, 0, 2) - const dist = vec4.Distance(v1, v2) + const v1 = new Vec4(2, 3, 0, 2) + const v2 = new Vec4(5, 7, 0, 2) + const dist = Vec4.Distance(v1, v2) expect(dist).toBe(5) }) test('Normalized, v(3,1,2,4) values given', () => { - const v = vec4.create(3, 1, 2, 4) - const norm = vec4.normalized(v) - expect(parseFloat(norm[0].toFixed(3))).toBe(0.548) - expect(parseFloat(norm[1].toFixed(3))).toBe(0.183) - expect(parseFloat(norm[2].toFixed(3))).toBe(0.365) - expect(parseFloat(norm[3].toFixed(3))).toBe(0.730) + const v = new Vec4(3, 1, 2, 4) + const norm = v.normalized + expect(parseFloat(norm.x.toFixed(3))).toBe(0.548) + expect(parseFloat(norm.y.toFixed(3))).toBe(0.183) + expect(parseFloat(norm.z.toFixed(3))).toBe(0.365) + expect(parseFloat(norm.w.toFixed(3))).toBe(0.730) }) test('Normalize, v(3,1,2,4) values given', () => { - const v = vec4.create(3, 1, 2, 4) - const norm = vec4.Normalize(v) - expect(parseFloat(norm[0].toFixed(3))).toBe(0.548) - expect(parseFloat(norm[1].toFixed(3))).toBe(0.183) - expect(parseFloat(norm[2].toFixed(3))).toBe(0.365) - expect(parseFloat(norm[3].toFixed(3))).toBe(0.730) + const v = new Vec4(3, 1, 2, 4) + const norm = Vec4.Normalize(v) + expect(parseFloat(norm.x.toFixed(3))).toBe(0.548) + expect(parseFloat(norm.y.toFixed(3))).toBe(0.183) + expect(parseFloat(norm.z.toFixed(3))).toBe(0.365) + expect(parseFloat(norm.w.toFixed(3))).toBe(0.730) }) })