# UnitTest assertEqual doesn't work for bigint

**URL:** <https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937>\
**Category:** Users\
**Created:** [October 2, 2020, 12:18pm UTC](https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937 "2020-10-02T12:18:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russel](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/russel/32/52_2.png) [@Russel](https://chapel.discourse.group/u/Russel)\
**Post date:** [October 2, 2020, 12:18pm UTC](https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937/1 "2020-10-02T12:18:24Z")

</div>

I thought I’d try the UnitTest module. As ever this means testing various implementations of the factorial function. However on compilation:

```auto
test/factorial_test.chpl:36: error: unresolved call 'assertEqual(bigint, bigint)'
$CHPL_HOME/modules/packages/UnitTest.chpl:516: note: this candidate did not match: Test.assertEqual(first, second)
test/factorial_test.chpl:36: note: because call is not written as a method call
$CHPL_HOME/modules/packages/UnitTest.chpl:516: note: but candidate function is a method

```

anyone any ideas as to how to “fix” this?

---

<div class="post-metadata">

**Author:** ![mppf](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mppf](https://chapel.discourse.group/u/mppf)\
**Post date:** [October 2, 2020, 1:17pm UTC](https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937/2 "2020-10-02T13:17:40Z")

</div>

Hi Russel,

Thanks for giving it a try. When writing these tests, the assert functions are methods on the `test` object passed to the test routine.

e.g.

```auto
  proc test3(test: borrowed Test) throws {
    test.assertEqual(2, 3.0);
  }

```

---

<div class="post-metadata">

**Author:** ![Russel](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/russel/32/52_2.png) [@Russel](https://chapel.discourse.group/u/Russel)\
**Post date:** [October 2, 2020, 5:28pm UTC](https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937/3 "2020-10-02T17:28:33Z")

</div>

OK. It would have helped if I had read the examples in more detail. 🙂

I think this issue is now closed, but another has arisen. New topic though.

---

<div class="post-metadata">

**Author:** ![ben-albrecht](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@ben-albrecht](https://chapel.discourse.group/u/ben-albrecht)\
**Post date:** [October 2, 2020, 6:00pm UTC](https://chapel.discourse.group/t/unittest-assertequal-doesnt-work-for-bigint/937/4 "2020-10-02T18:00:15Z")

</div>

@Russel - here’s a full working example for you:

```auto
// RusselsTest.chpl
use BigInteger;
use UnitTest;

proc testFoo(test: borrowed Test) throws {
  test.assertEqual(new bigint(2), new bigint(3));
}

UnitTest.main();

```

```auto
> mason test RusselsTest.chpl

======================================================================
FAIL RusselsTest.chpl: testFoo()
----------------------------------------------------------------------
AssertionError: assert failed - '2' != '3'

----------------------------------------------------------------------
Ran 1 test in 8.6196 seconds

FAILED (failures = 1 )

```
