compare.js 844 B

1234567891011121314151617181920
  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. WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js", "self");
  6. var str1 = "abcd1234"
  7. var str2 = "1234567a"
  8. var str3 = "abcd12345"
  9. var str1a = "abcd1234"
  10. var str1null = "\0\0ab\0\0cd1234\0"
  11. assert.isTrue(str1.localeCompare(str1a) == 0);
  12. assert.isTrue(str1.localeCompare(str1null) == 0);
  13. assert.isTrue(str1.localeCompare(str2) > 0);
  14. assert.isTrue(str1.localeCompare(str3) < 0);
  15. assert.isTrue(str1.localeCompare() < 0);
  16. console.log("pass")