Closes #4
I also included some unit tests to Analyser class. I did some modifications in this class because of some methods were having different behaviour from the expected.
Hello! It's me again!
I was making some tests in this PR and this is what I got: 👍
Tests AND
1. The result of the operation AND between booleans with value true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation AND between booleans with value true and false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation AND between booleans with value false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation AND between booleans with value false and true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation AND between booleans with value true, assigned into a rational variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Rational and Boolean`
1. The result of the operation AND between booleans with value true, assigned into a integer variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Integer and Boolean`
1. The result of the operation AND between booleans with value true, assigned into a character variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Character and Boolean`
1. The result of the operation AND between booleans with value true, assigned into a string variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between String and Boolean`
OR
1. The result of the operation OR between booleans with value true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation OR between booleans with value true and false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation OR between booleans with value false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation OR between booleans with value false and true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation OR between booleans with value true, assigned into a rational variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Rational and Boolean`
1. The result of the operation OR between booleans with value true, assigned into a integer variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Integer and Boolean`
1. The result of the operation OR between booleans with value true, assigned into a character variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Character and Boolean`
1. The result of the operation OR between booleans with value true, assigned into a string variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between String and Boolean`
XOR
1. The result of the operation XOR between booleans with value true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation XOR between booleans with value true and false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation XOR between booleans with value false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation XOR between booleans with value false and true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation XOR between booleans with value true, assigned into a rational variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Rational and Boolean`
1. The result of the operation XOR between booleans with value true, assigned into a integer variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Integer and Boolean`
1. The result of the operation XOR between booleans with value true, assigned into a character variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Character and Boolean`
1. The result of the operation XOR between booleans with value true, assigned into a string variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between String and Boolean`
NOT
1. The result of the operation NOT with a boolean with value true, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation NOT with a boolean with value false, assigned into a boolean variable.
Expected: It should be no semantic error.
Result: The code was translated without semantic errors.
1. The result of the operation NOT with a boolean with value true, assigned into a rational variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Rational and Boolean`
1. The result of the operation NOT with a boolean with value false, assigned into a rational variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Rational and Boolean`
1. The result of the operation NOT with a boolean with value true, assigned into a integer variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Integer and Boolean`
1. The result of the operation NOT with a boolean with value false, assigned into a integer variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Integer and Boolean`
1. The result of the operation NOT with a boolean with value true, assigned into a character variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Character and Boolean`
1. The result of the operation NOT with a boolean with value false, assigned into a character variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between Character and Boolean`
1. The result of the operation NOT with a boolean with value true, assigned into a string variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between String and Boolean`
1. The result of the operation NOT with a boolean with value false, assigned into a string variable.
Expected: Error Type.
Result: `line 8:4 Incompatible types between String and Boolean`
Some variations of this code were used in the test:
```
procedimento principal
inicio
var1: booleano;
var1 <- true;
var2: booleano;
var2 <- true;
var3: booleano;
var3 <- var1 e var2;
fim
```
Closes #4 I also included some unit tests to Analyser class. I did some modifications in this class because of some methods were having different behaviour from the expected.