Given a list of arbitrarily many strings, implement a function for each of the following conditions:
test if they are all lexically equal test if every string is lexically less than the one after it (i.e. whether the list is in strict ascending order)allEqual
is a function.
testString: 'assert(typeof allEqual === ''function'', ''allEqual
is a function.'');'
- text: azSorted
is a function.
testString: 'assert(typeof azSorted === ''function'', ''azSorted
is a function.'');'
- text: 'allEqual(["AA", "AA", "AA", "AA"])
returns true.'
testString: 'assert(allEqual(testCases[0]), ''allEqual(["AA", "AA", "AA", "AA"])
returns true.'');'
- text: 'azSorted(["AA", "AA", "AA", "AA"])
returns false.'
testString: 'assert(!azSorted(testCases[0]), ''azSorted(["AA", "AA", "AA", "AA"])
returns false.'');'
- text: 'allEqual(["AA", "ACB", "BB", "CC"])
returns false.'
testString: 'assert(!allEqual(testCases[1]), ''allEqual(["AA", "ACB", "BB", "CC"])
returns false.'');'
- text: 'azSorted(["AA", "ACB", "BB", "CC"])
returns true.'
testString: 'assert(azSorted(testCases[1]), ''azSorted(["AA", "ACB", "BB", "CC"])
returns true.'');'
- text: 'allEqual([])
returns true.'
testString: 'assert(allEqual(testCases[2]), ''allEqual([])
returns true.'');'
- text: 'azSorted([])
returns true.'
testString: 'assert(azSorted(testCases[2]), ''azSorted([])
returns true.'');'
- text: 'allEqual(["AA"])
returns true.'
testString: 'assert(allEqual(testCases[3]), ''allEqual(["AA"])
returns true.'');'
- text: 'azSorted(["AA"])
returns true.'
testString: 'assert(azSorted(testCases[3]), ''azSorted(["AA"])
returns true.'');'
- text: 'allEqual(["BB", "AA"])
returns false.'
testString: 'assert(!allEqual(testCases[4]), ''allEqual(["BB", "AA"])
returns false.'');'
- text: 'azSorted(["BB", "AA"])
returns false.'
testString: 'assert(!azSorted(testCases[4]), ''azSorted(["BB", "AA"])
returns false.'');'
```