ptk/test/list.c

109 lines
4.5 KiB
C
Raw Normal View History

// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
2024-08-08 19:17:53 +02:00
#include <test.h>
#include <ptk_list.h>
PTK_LIST_DEFINE(uint32_t);
TEST_START()
TEST("create list", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 5;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
TEST_ASSERT(list.allocated == size, "incorrect list allocation");
TEST_ASSERT(list.size == 0, "list isn't empty after allocation");
});
TEST("add elements without growing", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 5;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD(uint32_t, list, (uint32_t){21});
PTK_LIST_ADD(uint32_t, list, (uint32_t){37});
TEST_ASSERT(list.size == 2, "size doesn't match number of elements added");
TEST_ASSERT(list.allocated == size, "needlessly grew list");
TEST_ASSERT(list.data[0] == 21, "first element doesn't match");
TEST_ASSERT(list.data[1] == 37, "second element doesn't match");
});
TEST("add elements and grow", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 1;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD(uint32_t, list, (uint32_t){21});
PTK_LIST_ADD(uint32_t, list, (uint32_t){37});
TEST_ASSERT(list.allocated == size * 2, "(1st grow) didn't grow size by a factor of 2");
TEST_ASSERT(list.data[1] == 37, "(1st grow) element added in grown space doesn't match");
PTK_LIST_ADD(uint32_t, list, (uint32_t){2137});
TEST_ASSERT(list.allocated == size * 4, "(2nd grow) didn't grow size by a factor of 2");
TEST_ASSERT(list.data[2] == 2137, "(2nd grow) element added in grown space doesn't match");
});
TEST("add multiple elements", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 1;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD_ALL(uint32_t, list, { 21, 37, 2137, 31, 27, 7312 });
TEST_ASSERT(list.size == 6, "size doesn't match number of elements added");
TEST_ASSERT(list.data[0] == 21, "first element doesn't match");
TEST_ASSERT(list.data[5] == 7312, "last element doesn't match");
});
TEST("remove elements", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 1;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD(uint32_t, list, (uint32_t){21});
PTK_LIST_ADD(uint32_t, list, (uint32_t){37});
PTK_LIST_ADD(uint32_t, list, (uint32_t){2137});
PTK_LIST_ADD(uint32_t, list, (uint32_t){31});
PTK_LIST_ADD(uint32_t, list, (uint32_t){27});
PTK_LIST_ADD(uint32_t, list, (uint32_t){7312});
PTK_LIST_REMOVE(uint32_t, list, (uint32_t){2137});
TEST_ASSERT(list.size == 5, "size doesn't match after removing");
TEST_ASSERT(list.data[2] == 31, "remaining elements not moved to the left");
TEST_ASSERT(list.data[4] == 7312, "last element moved improperly (check for off-by-ones)");
});
TEST("remove multiple elements", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 1;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD(uint32_t, list, (uint32_t){21});
PTK_LIST_ADD(uint32_t, list, (uint32_t){37});
PTK_LIST_ADD(uint32_t, list, (uint32_t){2137});
PTK_LIST_ADD(uint32_t, list, (uint32_t){31});
PTK_LIST_ADD(uint32_t, list, (uint32_t){27});
PTK_LIST_ADD(uint32_t, list, (uint32_t){7312});
PTK_LIST_REMOVE_ALL(uint32_t, list, { 2137, 37, 27 });
TEST_ASSERT(list.size == 3, "size doesn't match after removing");
TEST_ASSERT(list.data[1] == 31, "remaining elements not moved to the left");
TEST_ASSERT(list.data[2] == 7312, "last element moved improperly (check for off-by-ones)");
});
TEST("remove elements at index", {
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
const size_t size = 1;
2024-08-08 19:17:53 +02:00
PTK_LIST(uint32_t) list = PTK_LIST_NEW(uint32_t, size);
PTK_LIST_ADD(uint32_t, list, (uint32_t){21});
PTK_LIST_ADD(uint32_t, list, (uint32_t){37});
PTK_LIST_ADD(uint32_t, list, (uint32_t){2137});
PTK_LIST_ADD(uint32_t, list, (uint32_t){31});
PTK_LIST_ADD(uint32_t, list, (uint32_t){27});
PTK_LIST_ADD(uint32_t, list, (uint32_t){7312});
PTK_LIST_REMOVE_AT(uint32_t, list, 2);
TEST_ASSERT(list.size == 5, "size doesn't match after removing");
TEST_ASSERT(list.data[2] == 31, "remaining elements not moved to the left");
TEST_ASSERT(list.data[4] == 7312, "last element moved improperly (check for off-by-ones)");
});
TEST_FINISH()