Skip to content

Commit bb494b9

Browse files
committed
feat(tests): adc func main em todos os testes
1 parent f598e4d commit bb494b9

File tree

8 files changed

+32
-4
lines changed

8 files changed

+32
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
int main ()
2+
{
13
int arr[2];
24
int x = arr["0"]; // E003: índice de array não numérico
5+
return 0;
6+
}

tests/semantic/fail/bad_if.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
if ("texto") { } // E002: condição não booleana em if (use comparação explícita)
1+
int main ()
2+
{
3+
if ("texto") { } // E002: condição não booleana em if (use comparação explícita)
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
int main ()
2+
{
13
int a = 1; char* s = "x";
24
int z = a + s; // E001: tipo inválido em operação aritmética
5+
}

tests/semantic/fail/wrong_assign.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
float f; int* p;
1+
int main ()
2+
{
3+
float f; int *p;
24
f = p; // E004: atribuição incompatível
5+
return 0;
6+
}

tests/semantic/pass/arith.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
int a = 1; float b = 2.5; float c = a + b; // ok: int->float
2-
int x = 7; int y = 3; int z = x % y; // ok: % em inteiros
1+
int main ()
2+
{
3+
int a = 1; float b = 2.5; float c = a + b; // ok: int->float
4+
int x = 7; int y = 3; int z = x % y; // ok: % em inteiros
5+
return x;
6+
}

tests/semantic/pass/arrays.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
int main ()
2+
{
13
int arr[3] = {10, 20, 30};
24
arr[1] = 99; // Lua: arr[2] = 99
35
int x = arr[0];
6+
return 0;
7+
}

tests/semantic/pass/logic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
int main ()
2+
{
13
int a = 1; float b = 0.0;
24
if (a && !b) { puts("ok"); } // coerção numérica p/ bool; ! -> not
5+
}

tests/semantic/pass/printf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
int main ()
2+
{
13
int a = 42; float b = 3.14;
24
printf("Valor: %d e %f\n", a, b);
35
puts("fim");
6+
}

0 commit comments

Comments
 (0)