Math.test.js 947 B

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