Option to sort truthTable
This commit is contained in:
@ -62,3 +62,23 @@ GET {{url}}/simplify/{{expression}}?simplify=false
|
||||
expression("A & B | C")
|
||||
%}
|
||||
GET {{url}}/simplify/table/{{expression}}
|
||||
|
||||
### GET with table sorted by true first
|
||||
< {%
|
||||
import {expression} from "./common";
|
||||
|
||||
expression("A & B | C")
|
||||
%}
|
||||
GET {{url}}/simplify/table/{{expression}}?sort=TRUE_FIRST
|
||||
|
||||
> {%
|
||||
client.test("Response body is sorted by true first", () => {
|
||||
const table = response.body.truthTable;
|
||||
const results = table.truthMatrix.map(arr => arr[arr.length - 1])
|
||||
const expected = results.slice() // Creates a copy of the array
|
||||
expected.sort((a, b) => b - a)
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
client.assert(results[i] === expected[i], "Response body is not sorted by true first")
|
||||
}
|
||||
});
|
||||
%}
|
||||
|
Reference in New Issue
Block a user