Code Monkey home page Code Monkey logo

Comments (1)

jsejcksn avatar jsejcksn commented on July 19, 2024 1

Here's a standalone test that can be simply be copied + pasted and run locally to reproduce the juxtaposition:

module

test.ts:

// v0.226.0 - https://github.com/denoland/deno_std/blob/release-2024.06.03/assert/deno.json#L3
import { assertAlmostEquals as assertAlmostEquals_0_226_0 } from "https://raw.githubusercontent.com/denoland/deno_std/release-2024.06.03/assert/assert_almost_equals.ts";

// v1.0.0-rc.1 - https://github.com/denoland/deno_std/blob/release-2024.06.06/assert/deno.json#L3
import { assertAlmostEquals as assertAlmostEquals_1_0_0_rc_1 } from "https://raw.githubusercontent.com/denoland/deno_std/release-2024.06.06/assert/assert_almost_equals.ts";

const positiveActual = 9.888977057628651;
const positiveExpected = 9.888977058;
const negativeActual = -9.888977057628651;
const negativeExpected = -9.888977058;

Deno.test("0.226.0 - positive", () => {
  assertAlmostEquals_0_226_0(positiveActual, positiveExpected);
});

Deno.test("0.226.0 - negative", () => {
  assertAlmostEquals_0_226_0(negativeActual, negativeExpected);
});

Deno.test("1.0.0-rc.1 - positive", () => {
  assertAlmostEquals_1_0_0_rc_1(positiveActual, positiveExpected);
});

Deno.test("1.0.0-rc.1 - negative", () => {
  assertAlmostEquals_1_0_0_rc_1(negativeActual, negativeExpected);
});
output
% deno --version
deno 1.44.1 (release, aarch64-apple-darwin)
v8 12.6.228.3
typescript 5.4.5

% deno test test.ts
running 4 tests from ./test.ts
0.226.0 - positive ... ok (0ms)
0.226.0 - negative ... ok (0ms)
1.0.0-rc.1 - positive ... ok (0ms)
1.0.0-rc.1 - negative ... FAILED (0ms)

 ERRORS

1.0.0-rc.1 - negative => ./test.ts:24:6
error: AssertionError: Expected actual: "-9.88897705762865e+0" to be close to "-9.888977058e+0": delta "3.7134917363346176e-10" is greater than "-9.888977058e-7".
  throw new AssertionError(
        ^
    at assertAlmostEquals (https://raw.githubusercontent.com/denoland/deno_std/release-2024.06.06/assert/assert_almost_equals.ts:51:9)
    at file:///Users/deno/test.ts:25:3

 FAILURES

1.0.0-rc.1 - negative => ./test.ts:24:6

FAILED | 3 passed | 1 failed (1ms)

error: Test failed

from deno_std.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.