Get LIBC_MEM and LIBC_STDIO building with aarch64

This commit is contained in:
Justine Tunney 2023-05-09 08:08:56 -07:00
parent ae0ee59614
commit d04430f4ef
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
81 changed files with 440 additions and 1064 deletions

View file

@ -16,9 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/log/libfatal.internal.h"
#include "libc/mem/alg.h"
#include "libc/mem/arraylist.internal.h"
#include "libc/log/libfatal.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
@ -48,7 +48,8 @@ TEST(append, worksGreatForScalars) {
}
ASSERT_EQ(1024, s.i);
for (size_t i = 0; i < s.i; ++i) ASSERT_EQ('a', s.p[i]);
free_s(&s.p);
free(s.p);
s.p = 0;
}
TEST(append, isGenericallyTyped) {
@ -63,7 +64,8 @@ TEST(append, isGenericallyTyped) {
for (size_t i = 0; i < s.i; ++i) {
ASSERT_EQ(0x31337, s.p[i]);
}
free_s(&s.p);
free(s.p);
s.p = 0;
}
TEST(concat, worksGreatForStrings) {
@ -79,7 +81,8 @@ TEST(concat, worksGreatForStrings) {
"Wir werden wieder auferstehen\n",
s.p);
ASSERT_EQ(strlen(ks) * 2 + 1, s.i);
free_s(&s.p);
free(s.p);
s.p = 0;
}
TEST(concat, isGenericallyTyped) {
@ -95,5 +98,6 @@ TEST(concat, isGenericallyTyped) {
u"Unsere schwarzen Seelen bekommt ihr nicht.\n",
s.p);
ASSERT_EQ(strlen16(ks) * 2 + 1, s.i);
free_s(&s.p);
free(s.p);
s.p = 0;
}

View file

@ -32,7 +32,7 @@ TEST(grow, testNull_hasAllocatingBehavior) {
EXPECT_TRUE(__grow(&p, &capacity, 1, 0));
EXPECT_NE(NULL, p);
EXPECT_EQ(32, capacity);
free_s(&p);
free(p);
}
TEST(grow, testCapacity_isInUnits_withTerminatorGuarantee) {
@ -41,7 +41,7 @@ TEST(grow, testCapacity_isInUnits_withTerminatorGuarantee) {
EXPECT_TRUE(__grow(&p, &capacity, 8, 0));
EXPECT_NE(NULL, p);
EXPECT_EQ(32 / 8 + 1, capacity);
free_s(&p);
free(p);
}
TEST(grow, testStackMemory_convertsToDynamic) {
@ -69,7 +69,7 @@ TEST(grow, testGrowth_clearsNewMemory) {
EXPECT_GT(capacity, 123);
for (i = 0; i < 123; ++i) ASSERT_EQ('a', p[i]);
for (i = 123; i < capacity; ++i) ASSERT_EQ(0, p[i]);
free_s(&p);
free(p);
}
TEST(grow, testBonusParam_willGoAboveAndBeyond) {
@ -77,11 +77,11 @@ TEST(grow, testBonusParam_willGoAboveAndBeyond) {
char *p = malloc(capacity);
EXPECT_TRUE(__grow(&p, &capacity, 1, 0));
EXPECT_LT(capacity, 1024);
free_s(&p);
free(p);
p = malloc((capacity = 32));
EXPECT_TRUE(__grow(&p, &capacity, 1, 1024));
EXPECT_GT(capacity, 1024);
free_s(&p);
free(p);
}
TEST(grow, testOverflow_returnsFalseAndDoesNotFree) {
@ -95,6 +95,6 @@ TEST(grow, testOverflow_returnsFalseAndDoesNotFree) {
EXPECT_EQ(1, p[0]);
EXPECT_EQ(2, p[1]);
EXPECT_EQ(3, p[2]);
free_s(&p);
free(p);
}
}