mixed.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. if (this.WScript && this.WScript.LoadScriptFile) { // Check for running in ch
  6. this.WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
  7. }
  8. var tests = [
  9. {
  10. name: "Add and sub",
  11. body: function () {
  12. assert.isTrue(1n+2n+3n+4n == 10n);
  13. assert.isTrue(1n-2n+3n+4n == 6n);
  14. assert.isTrue(1n-2n-3n+4n == 0n);
  15. assert.isTrue(1n-2n-3n-4n == -8n);
  16. }
  17. },
  18. {
  19. name: "valueOf",
  20. body: function() {
  21. assert.isTrue(1n+{valueOf:() => 2n} == 3n);
  22. assert.isTrue(1n-{valueOf:() => 2n} == -1n);
  23. assert.isTrue(1n+{valueOf:() => -2n} == -1n);
  24. }
  25. },
  26. ];
  27. testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });