Math.test.js 977 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const MathMock = artifacts.require('MathMock');
  2. contract('Math', function (accounts) {
  3. let math;
  4. beforeEach(async function () {
  5. math = await MathMock.new();
  6. });
  7. it('returns max64 correctly', async function () {
  8. const a = 5678;
  9. const b = 1234;
  10. await math.max64(a, b);
  11. const result = await math.result64();
  12. assert.equal(result, a);
  13. });
  14. it('returns min64 correctly', async function () {
  15. const a = 5678;
  16. const b = 1234;
  17. await math.min64(a, b);
  18. const result = await math.result64();
  19. assert.equal(result, b);
  20. });
  21. it('returns max256 correctly', async function () {
  22. const a = 5678;
  23. const b = 1234;
  24. await math.max256(a, b);
  25. const result = await math.result256();
  26. assert.equal(result, a);
  27. });
  28. it('returns min256 correctly', async function () {
  29. const a = 5678;
  30. const b = 1234;
  31. await math.min256(a, b);
  32. const result = await math.result256();
  33. assert.equal(result, b);
  34. });
  35. });