Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update test framework to latest sb #117

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions tests/cleo_tests/FilesystemOperations/0A9A.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,24 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0A9A" // open_file
debug_on

test("0A9A (open_file)", @tests)
test("0A9A (open_file)", tests)
terminate_this_custom_script


function tests

it("should fail on a non-existing file", @test1)
it("should open existing file", @test2)
it("should fail on a non-existing file", test1)
it("should open existing file", test2)
return

function test1
if
0@ = open_file "cleo\not_a_file.txt" {mode} "r" // tested opcode
then
assert(false)
else
assert(true)
end
0@ = open_file "cleo\\not_a_file.txt" {mode} "r" // tested opcode
assert_result_false()
end

function test2
if
0@ = open_file "cleo\.cleo.log" {mode} "r" // tested opcode
0@ = open_file "cleo\\.cleo.log" {mode} "r" // tested opcode
then
assert(true)
close_file 0@
Expand Down
18 changes: 9 additions & 9 deletions tests/cleo_tests/MemoryOperations/0A8C.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name '0A8C'
test("0A8C (write_memory)", @tests)
test("0A8C (write_memory)", tests)
terminate_this_custom_script


function tests
before_each(@before)

it("should write 0 bytes", @test1)
it("should write 1 byte", @test2)
it("should write 2 bytes", @test3)
it("should write 3 bytes", @test4)
it("should write 4 bytes", @test5)
it("should write 5 bytes", @test6)
it("should write 7 bytes", @test7)
it("should write float", @test8)
it("should write 0 bytes", test1)
it("should write 1 byte", test2)
it("should write 2 bytes", test3)
it("should write 3 bytes", test4)
it("should write 4 bytes", test5)
it("should write 5 bytes", test6)
it("should write 7 bytes", test7)
it("should write float", test8)
return

:before
Expand Down
14 changes: 7 additions & 7 deletions tests/cleo_tests/MemoryOperations/0A8D.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name '0A8D'
test("0A8D (read_memory)", @tests)
test("0A8D (read_memory)", tests)
terminate_this_custom_script

function tests
before_each(@prepare_tests)

it("should read 0 bytes", @test1)
it("should read 1 byte", @test2)
it("should read 2 bytes", @test3)
it("should read 3 bytes", @test4)
it("should read 4 bytes", @test5)
it("should read float", @test6)
it("should read 0 bytes", test1)
it("should read 1 byte", test2)
it("should read 2 bytes", test3)
it("should read 3 bytes", test4)
it("should read 4 bytes", test5)
it("should read float", test6)

return

Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0A96.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0A96" // get_ped_pointer
test("0A96 (get_ped_pointer)", @tests)
test("0A96 (get_ped_pointer)", tests)
terminate_this_custom_script

function tests

it("should return valid pointer", @test1)
it("should return valid pointer", test1)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0A97.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0A97" // get_vehicle_pointer
test("0A97 (get_vehicle_pointer)", @tests)
test("0A97 (get_vehicle_pointer)", tests)
terminate_this_custom_script

function tests

it("should return a valid pointer", @test1)
it("should return a valid pointer", test1)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0A98.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0A98" // get_vehicle_pointer
test("0A98 (get_object_pointer)", @tests)
test("0A98 (get_object_pointer)", tests)
terminate_this_custom_script

function tests

it("should return a valid pointer", @test1)
it("should return a valid pointer", test1)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0AA4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AA4"
test("0AA4 (get_dynamic_library_procedure)", @tests)
test("0AA4 (get_dynamic_library_procedure)", tests)
terminate_this_custom_script

function tests

it("should return address of Sleep function from kernel32.dll", @test1)
it("should return address of Sleep function from kernel32.dll", test1)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0AC6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AC6" // get_label_pointer
test("0AC6 (get_label_pointer)", @tests)
test("0AC6 (get_label_pointer)", tests)
terminate_this_custom_script

function tests

it("should return valid pointer", @test1)
it("should return valid pointer", test1)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0AC7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AC7" // get_var_pointer
test("0AC7 (get_var_pointer)", @tests)
test("0AC7 (get_var_pointer)", tests)
terminate_this_custom_script

function tests

it("should return valid pointer", @test1)
it("should return valid pointer", test1)
return

function test1
Expand Down
6 changes: 3 additions & 3 deletions tests/cleo_tests/MemoryOperations/0AC8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AC8" // allocate_memory
test("0AC8 (allocate_memory)", @tests)
test("0AC8 (allocate_memory)", tests)
terminate_this_custom_script

function tests

before_each(@allocate)
after_each(@free)

it("should return valid pointer", @test1)
it("should point to zero-filled mem in CLEO5", @test2)
it("should return valid pointer", test1)
it("should point to zero-filled mem in CLEO5", test2)
return

function test1
Expand Down
4 changes: 2 additions & 2 deletions tests/cleo_tests/MemoryOperations/0AC9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AC9" // free_memory
test("0AC9 (free_memory)", @tests)
test("0AC9 (free_memory)", tests)
terminate_this_custom_script

function tests

it("should free allocated memory", @test1)
it("should free allocated memory", test1)
return

function test1
Expand Down
15 changes: 5 additions & 10 deletions tests/cleo_tests/MemoryOperations/0AE9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AE9" // pop_float
test("0AE9 (pop_float)", @tests)
test("0AE9 (pop_float)", tests)
terminate_this_custom_script

function tests

it("should pop float from stack", @test1)
it("should pop float from stack", test1)
return


Expand All @@ -17,14 +17,9 @@ function tests
call_function 0x0823CEE {argCount} 1 {pop} 1 {arg} 2@ // double atof(const char *)

pop_float {result} 3@

if
3@ == 42.5
then
assert(true)
else
assert(false)
end

3@ == 42.5
assert_result_true()

end
end
15 changes: 5 additions & 10 deletions tests/cleo_tests/MemoryOperations/0AEA.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,19 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AEA" // get_ped_ref
test("0AEA (get_ped_ref)", @tests)
test("0AEA (get_ped_ref)", tests)
terminate_this_custom_script

function tests
it("should return ped handle for pointer", @test1)
it("should return ped handle for pointer", test1)
return

function test1
int handle = get_player_char 0
int ptr = get_ped_pointer handle
int handle2 = get_ped_ref ptr

if
handle == handle2
then
assert(true)
else
assert(false)
end

handle == handle2
assert_result_true()
end
end
13 changes: 4 additions & 9 deletions tests/cleo_tests/MemoryOperations/0AEB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AEB" // get_vehicle_ref
test("0AEB (get_vehicle_ref)", @tests)
test("0AEB (get_vehicle_ref)", tests)
terminate_this_custom_script

function tests
it("should return vehicle handle for pointer", @test1)
it("should return vehicle handle for pointer", test1)
return

function test1
Expand All @@ -17,13 +17,8 @@ function tests
int handle2 = get_vehicle_ref ptr
mark_car_as_no_longer_needed handle

if
handle == handle2
then
assert(true)
else
assert(false)
end
handle == handle2
assert_result_true()
end
end

13 changes: 4 additions & 9 deletions tests/cleo_tests/MemoryOperations/0AEC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name "0AEC" // get_object_ref
test("0AEC (get_object_ref)", @tests)
test("0AEC (get_object_ref)", tests)
terminate_this_custom_script

function tests
it("should return vehicle handle for pointer", @test1)
it("should return vehicle handle for pointer", test1)
return

function test1
Expand All @@ -17,13 +17,8 @@ function tests
int handle2 = get_object_ref ptr
mark_object_as_no_longer_needed handle

if
handle == handle2
then
assert(true)
else
assert(false)
end
handle == handle2
assert_result_true()
end
end

Expand Down
10 changes: 5 additions & 5 deletions tests/cleo_tests/Text/0AD3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name '0AD3'
test("0AD3 (string_format)", @tests)
test("0AD3 (string_format)", tests)
terminate_this_custom_script


function tests
it("should format string", @test1)
it("should respect short string variable size", @test2)
it("should respect long string variable size", @test3)
it("should create long text", @test4)
it("should format string", test1)
it("should respect short string variable size", test2)
it("should respect long string variable size", test3)
it("should create long text", test4)

return

Expand Down
12 changes: 6 additions & 6 deletions tests/cleo_tests/Text/0AD4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name '0AD4'
test("0AD4 (scan_string)", @tests)
test("0AD4 (scan_string)", tests)
terminate_this_custom_script


function tests
it("should scan numbers", @test1)
it("should scan characters", @test2)
it("should scan strings", @test3)
it("should report arg count missmatch", @test4)
it("should respect target string size", @test5)
it("should scan numbers", test1)
it("should scan characters", test2)
it("should scan strings", test3)
it("should report arg count missmatch", test4)
it("should respect target string size", test5)
return

function test1
Expand Down
Loading
Loading