Math.test.js 972 B

12345678910111213141516171819202122232425262728293031323334
  1. const MathMock = artifacts.require('MathMock');
  2. contract('Math', function () {
  3. const min = 1234;
  4. const max = 5678;
  5. beforeEach(async function () {
  6. this.math = await MathMock.new();
  7. });
  8. describe('max', function () {
  9. it('is correctly detected in first argument position', async function () {
  10. const result = await this.math.max(max, min);
  11. assert.equal(result, max);
  12. });
  13. it('is correctly detected in second argument position', async function () {
  14. const result = await this.math.max(min, max);
  15. assert.equal(result, max);
  16. });
  17. });
  18. describe('min', function () {
  19. it('is correctly detected in first argument position', async function () {
  20. const result = await this.math.min(min, max);
  21. assert.equal(result, min);
  22. });
  23. it('is correctly detected in second argument position', async function () {
  24. const result = await this.math.min(max, min);
  25. assert.equal(result, min);
  26. });
  27. });
  28. });