#include "domain_tests.h"
#include "../../domain/trench.h"
#include <assert.h>
#include <string.h>

void test_domain(void){
    Trench trench(1,"red",100,10,"photo");
    assert(trench.size()==1);
    assert(strcmp(trench.colour(),"red")==0);
    assert(trench.price()==100);
    assert(trench.quantity()==10);
    assert(strcmp(trench.photograph(),"photo")==0);
    trench.size(2);
    assert(trench.size()==2);
    trench.colour("blue");
    assert(strcmp(trench.colour(),"blue")==0);
    trench.price(200);
    assert(trench.price()==200);
    trench.quantity(20);
    assert(trench.quantity()==20);
    trench.photograph("photo2");
    assert(strcmp(trench.photograph(),"photo2")==0);
    Trench trench2(trench);
    assert(trench2.size()==2);
    assert(strcmp(trench2.colour(),"blue")==0);
    assert(trench2.price()==200);
    assert(trench2.quantity()==20);
    assert(strcmp(trench2.photograph(),"photo2")==0);
    trench2.size(3);
    assert(trench2.size()==3);
    assert(trench.size()==2);
    trench2.colour("green");
    assert(strcmp(trench2.colour(),"green")==0);
    assert(strcmp(trench.colour(),"blue")==0);
    trench2.price(300);
    assert(trench2.price()==300);
    assert(trench.price()==200);
    trench2.quantity(30);
    assert(trench2.quantity()==30);
    assert(trench.quantity()==20);
    trench2.photograph("photo3");
    assert(strcmp(trench2.photograph(),"photo3")==0);
    assert(strcmp(trench.photograph(),"photo2")==0);
    Trench trench3 = trench2;
    assert(trench2==trench3);
    assert(!(trench==trench3));
    trench3.price(100);
    assert(trench2.price()==300);
    assert(trench3.price()==100);
    char* string = trench.toString();
    assert(strcmp(string,"Size: 2 | Colour: blue | Price: 200 | Quantity: 20 | Photograph Link: photo2 \n")==0);
    delete[] string;
}