tlang/source/tlang/testing
Tristan B. Velloza Kildaire 493da1a4e7
Pointer support (#2)
* Make branches not identical

* Removed temporary file

* Typecheck

- Added `attemptPointerAriehmeticCoercion(Value, Value)`

* Typechecker

- Moved `attemptPointerAriehmeticCoercion(Value, Value)` to class-level and made privately accessible

* Test cases

- Added pointer arithmetic in the form of `*(ptr+0)` to `simple_pointer.t` to start testing it out

* Typechecker

- When handling `BinaryOperatorExpression` call `attemptPointerAriehmeticCoercion(Value, Value)` with both `(vLhsInstr, vRhsInstr)` before we call `vLhsInstr.getInstrType()` and `vRhsInstr.getInstrType()` before `isSameType(vLhsType, vRhsType)`. By doing so we attempt to coerce the types of both instructions if one is a pointer and another is an integer, else do nothing

* DGen

- When emitting for `PointerDereferenceAssignmentInstruction` we didn't wrap `<expr>` with `()`. So instead of `*(<expre>)` we got `*<expr>` which doesn't work if you're doing pointer arithmetic

* Test cases

- Added `simple_pointer_cast.t` to test casting (currently broken parsing-wise)

DGen

- Added a todo for semantic tests for the `simple_pointer_cast.t` test case

* Parser

- Added a TODO - we need a `parseType()`

* Test cases

- Removed `simple_cast_complex_type.t` as it is wrong, syntax wise

* Test cases

- Removed coercion usage, I am only testing the casting here (explicit)

* Test cases

- Removed `simple_pointer_cast.t` and replace it with `simple_pointer_cast_le.t` which casts the integer pointer to a byte pointer and sets the lowest significant byte (little endian hence at base of integer) to `2+2`

DGen

- Added semantic test for `simple_pointer_cast_le.t`

* Test cases

- Update `simple_pointer_cast_le.t` to do some pointer airthmetic at the byte-level of the 32-bit integer

DGen

- Updated the semantic test code generation for `simple_pointer_cast_le.t` to check for new values

* Added 'simple_pointer_cast_le.t' to Emit tests

* TypeChecker

- Update `isSameType(Type t1, Type t2)` to now handle pointers explicitly and in a recursive manner based on their referred types
- This check occurs before the `Integer` type check therefore following the rule of most specific types to least

* Test cases

- Added new test case `simple_pointer_malloc.t`
- Added semantic code test generation for `simple_pointer_malloc.t`
- Added `malloc_test.sh` to compile and generate `mem.o` from `mem.c` to link it then with `simple_pointer_malloc.t`
- Added `mem.c`  external C file to generate the required `mem.o` for linking against `simple_pointer_malloc.t`

* Test cases

- Updated `malloc_test.sh` to look for any `brk()` system calls and fixed its interpreter path
2023-04-17 16:50:11 +02:00
..
typecheck DGen 2022-12-11 18:09:56 +02:00
basic1.t Updated unit test for struct parsing 2021-05-31 18:16:06 +02:00
basic1_invalid.t Added requirement for having a module header at the beginning of each source file 2021-03-21 13:10:18 +02:00
basic1_invalid_2.t Added requirement for having a module header at the beginning of each source file 2021-03-21 13:10:18 +02:00
basic1_typedeclrationchecking.t Check off things already implemented 2021-06-06 15:54:15 +02:00
basic1_typedeclrationchecking_grandresolvefail.t Moved case with path resolution not visited to another test case 2021-06-04 13:43:44 +02:00
basic2.t Updated test case to add missing module header 2021-03-21 13:11:12 +02:00
basic2_mega_fucked.t Added requirement for having a module header at the beginning of each source file 2021-03-21 13:10:18 +02:00
classTest1.t Added TODO 2021-04-09 15:56:15 +02:00
class_deps_simple.t WIP: Found a fix for context lookup failure 2022-10-13 13:21:35 +02:00
collide_container.t Implemented unit test testing 2021-04-01 19:18:52 +02:00
collide_container_module1.t Collision with Module still not working 2021-04-01 20:26:17 +02:00
collide_container_module2.t Added missing `performLex` call 2021-04-01 20:52:36 +02:00
collide_container_non_module.t Cleaned up collision unit tests (posotive cases) 2021-04-01 21:00:48 +02:00
collide_member.t Added member collision unit test 2021-04-01 21:08:37 +02:00
else_if_without_if.pl Added requirement for having a module header at the beginning of each source file 2021-03-21 13:10:18 +02:00
else_without_if.pl Added requirement for having a module header at the beginning of each source file 2021-03-21 13:10:18 +02:00
file_io.c Check 2023-01-28 18:12:49 +02:00
mem.c Pointer support (#2) 2023-04-17 16:50:11 +02:00
nested_conditionals.t Lexer 2022-12-19 15:37:55 +02:00
precedence_collision_test.t Added precedence test 2021-04-02 18:45:59 +02:00
simple1_module_positive.t Disabl typechecking unit tests for now 2021-06-08 10:52:22 +02:00
simple1_oop.t Fixed test case simple1_oop.t 2022-12-20 16:10:13 +02:00
simple2_name_recognition.t Ensure they are variables 2021-06-08 13:03:46 +02:00
simple_cast.t DGen 2023-01-15 12:40:42 +02:00
simple_class_ref_static.t Increased complexity of test case 2022-10-15 21:00:59 +02:00
simple_conditionals.t Lexer 2022-12-19 15:37:55 +02:00
simple_discard.t Instruction 2023-01-13 10:49:47 +02:00
simple_do_while.t Instruction 2023-01-11 10:43:29 +02:00
simple_extern.t Check 2023-01-28 18:12:49 +02:00
simple_for_loops.t Instruction 2023-01-11 10:43:29 +02:00
simple_function_decls.t DGen 2022-12-17 14:31:03 +02:00
simple_functions.t Instruction 2022-12-17 19:02:14 +02:00
simple_functor.t WIP: Found a fix for context lookup failure 2022-10-13 13:21:35 +02:00
simple_literals.t Test case 2023-02-03 16:29:50 +02:00
simple_literals2.t Exceptions 2023-02-04 14:37:40 +02:00
simple_literals3.t Test cases 2023-02-06 16:08:54 +02:00
simple_literals4.t Typechecker 2023-02-06 21:49:25 +02:00
simple_literals5.t Typechecker 2023-02-06 21:49:25 +02:00
simple_literals6.t Test cases 2023-02-11 12:02:06 +02:00
simple_pointer.t Pointer support (#2) 2023-04-17 16:50:11 +02:00
simple_pointer_cast_le.t Pointer support (#2) 2023-04-17 16:50:11 +02:00
simple_pointer_malloc.t Pointer support (#2) 2023-04-17 16:50:11 +02:00
simple_variables.t App 2022-12-14 19:49:08 +02:00
simple_variables_class.t Disabled ClassStaticAllocate processing code in typechecker for now 2022-10-15 20:24:23 +02:00
simple_variables_decls_ass.t DGen 2022-12-13 09:43:31 +02:00
simple_variables_only_decs.t CodeEmitter 2022-12-11 21:41:15 +02:00
simple_while.t Instruction 2023-01-04 12:03:50 +02:00
test3.t Everything works 2021-04-01 17:33:25 +02:00