### GET Atomic Expression
GET {{url}}/simplify/A

### GET Invalid Expression should return 400 Bad Request
GET {{url}}/simplify/A B

> {%
    client.test("Status code is 400", () => {
        client.assert(response.status === 400, "Response status is not 400");
    });
    client.test("Content-type is application/json", () => {
        client.assert(response.headers.valueOf("content-type") === "application/json", "Content-Type is not application/json")
    });
%}

### GET And Expression
< {%
    import {expression} from './common.js';

    expression("A & B")
%}
GET {{url}}/simplify/{{expression}}

### GET Or Expression
< {%
    import {expression} from "./common";

    expression("A | B")
%}
GET {{url}}/simplify/{{expression}}

### GET Not Expression
GET {{url}}/simplify/!A

### GET Implication Expression
< {%
    import {expression} from "./common";

    expression("A => B")
%}
GET {{url}}/simplify/{{expression}}

### GET expression and don't simplify
< {%
    import {expression} from "./common";

    expression("A & A")
%}

GET {{url}}/simplify/{{expression}}?simplify=false

> {%
    client.test("Response body is the same as the input", () => {
        client.assert(response.body.after === response.body.before, "Response body is not the same as the input");
    });
%}

### GET with table
< {%
    import {expression} from "./common";

    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")
        }
    });
%}

### GET with table and hide false values
< {%
    import {expression} from "./common";

    expression("A & B | C")
%}
GET {{url}}/simplify/table/{{expression}}?hide=FALSE

> {%
    client.test("Response body does not contain false values", () => {
        const table = response.body.truthTable;
        const results = table.truthMatrix.map(arr => arr[arr.length - 1])
        for (let i = 0; i < results.length; i++) {
            client.assert(results[i] === true, "Response body contains false values")
        }
    });
%}

### GET and assert operation

< {%
    import {expression} from "./common";

    expression("A & A")
%}
GET {{url}}/simplify/{{expression}}

> {%
    client.test("Response body is the same as the input", () => {
        const operations = response.body.operations;
        client.assert(operations.length === 1, "Response body does not contain a single operation")
        client.assert(operations[0].before === "A ⋀ A", `The before field dos not match the expected, was ${operations[0].before} but expected A ⋀ A`)
        client.assert(operations[0].after === "A", `The after field does not match the expected value, was ${operations[0].after} but expected A`)
        client.assert(operations[0].law === "ABSORPTION_LAW", `The law field does not match the expected value, was ${operations[0].law} but expected ABSORPTION_LAW`)
    });
%}

### GET with simplify="true"

GET {{url}}/simplify/A?simplify=true&hide=NONE&sort=DEFAULT&caseSensitive=false&hideIntermediate=false

### GET and ignore case

< {%
    import {expression} from "./common";

    expression("A & a")
%}
GET {{url}}/simplify/{{expression}}?ignoreCase=true

> {%
    client.test("Response body is the same as the input", () => {
        client.assert(response.body.after === "A", "Response body is not simplified to 'a'");
    });
%}