SeqUtils.mjs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * SeqUtils tests.
  3. *
  4. * @author Chris van Marle
  5. * @copyright Copyright 2017
  6. * @license Apache-2.0
  7. */
  8. import TestRegister from "../../TestRegister";
  9. TestRegister.addTests([
  10. {
  11. name: "SeqUtils - Numeric sort photos",
  12. input: "Photo-1.jpg\nPhoto-4.jpg\nPhoto-2.jpg\nPhoto-3.jpg",
  13. expectedOutput: "Photo-1.jpg\nPhoto-2.jpg\nPhoto-3.jpg\nPhoto-4.jpg",
  14. recipeConfig: [
  15. {
  16. "op": "Sort",
  17. "args": ["Line feed", false, "Numeric"]
  18. }
  19. ],
  20. },
  21. {
  22. name: "SeqUtils - Numeric sort CVE IDs",
  23. input: "CVE-2017-1234,CVE-2017-9999,CVE-2017-10000,CVE-2017-10001,CVE-2017-12345,CVE-2016-1234,CVE-2016-4321,CVE-2016-10000,CVE-2016-9999,CVE-2016-10001",
  24. expectedOutput: "CVE-2017-12345,CVE-2017-10001,CVE-2017-10000,CVE-2017-9999,CVE-2017-1234,CVE-2016-10001,CVE-2016-10000,CVE-2016-9999,CVE-2016-4321,CVE-2016-1234",
  25. recipeConfig: [
  26. {
  27. "op": "Sort",
  28. "args": ["Comma", true, "Numeric"]
  29. }
  30. ],
  31. },
  32. {
  33. name: "SeqUtils - Hexadecimal sort",
  34. input: "06,08,0a,0d,0f,1,10,11,12,13,14,15,16,17,18,19,1a,1b,1c,1d,1e,1f,2,3,4,5,7,9,b,c,e",
  35. expectedOutput: "1,2,3,4,5,06,7,08,9,0a,b,c,0d,e,0f,10,11,12,13,14,15,16,17,18,19,1a,1b,1c,1d,1e,1f",
  36. recipeConfig: [
  37. {
  38. "op": "Sort",
  39. "args": ["Comma", false, "Numeric (hexadecimal)"]
  40. }
  41. ],
  42. },
  43. ]);