Commit Graph

  • 7bcc68e9ff Did something wrong in vim, remove odd file development Kwarde 2025-08-04 12:45:29 +02:00
  • f790f5948c Adds _initializor to handle entry/exit. 'tests' now exits with 'amount of failed tests' as exit code Kwarde 2025-08-04 12:44:44 +02:00
  • 02580e9b0b 1) atoi: signed+unsigned overflow checks (JC,JO) 2) correct values for MIN_INTxx constants Kwarde 2025-08-03 13:25:47 +02:00
  • d386aa5744 Strip symbols from binary file in non-debug make Kwarde 2025-08-02 14:48:13 +02:00
  • 77c578e79b __INTERNAL_fmt: Improve %check_formatted_len for arrays, check and insert '(null) byte per byte (instead of byte,qword,byte) Kwarde 2025-08-01 11:11:37 +02:00
  • 486b4d5d9b __INTERNAL_fmt: write_format_data writes to array directly; do not strcat __fmt_Buff to array Kwarde 2025-08-01 11:01:16 +02:00
  • 68ee2828c1 Make fetching args from stack (__INTERNAL_fmt) bit clearer Kwarde 2025-07-31 18:22:26 +02:00
  • be81866768 __INTERNAL_fmt: fix stack offset when output=memory instead of fd Kwarde 2025-07-31 14:34:46 +02:00
  • 00568e2e7c Adds format(), modified __INTERNAL_fmt to allow writing to memory (instead of writing to given FD) Kwarde 2025-07-31 14:18:00 +02:00
  • c36ae377ba Remove invalid line from tests.asm Kwarde 2025-07-31 14:17:31 +02:00
  • 7c89bfe7d3 console.asm: printf** variables renamed to __fmt_** args since printf->__INTERNAL_fmt Kwarde 2025-07-31 13:04:09 +02:00
  • 93c606541d Remove old return value comment of reads() Kwarde 2025-07-31 11:47:46 +02:00
  • b39f39fb99 Tests: disable reads(), print assertion messages to stderr (call eprintf, not printf) Kwarde 2025-07-31 11:36:22 +02:00
  • 6f2e427d86 Adds reads() Kwarde 2025-07-31 11:34:50 +02:00
  • ca6027abcd strfind: assure re-check is done on mismatch after initial match + add tests Kwarde 2025-07-28 17:29:03 +02:00
  • eb5398da8f Adds strfind Kwarde 2025-07-28 16:54:55 +02:00
  • 1848e815fb Makefile: rename COMPILER -> ASSEMBLER Kwarde 2025-07-28 10:55:31 +02:00
  • 9c9aeabc97 Don't use in constants file Kwarde 2025-07-28 10:41:45 +02:00
  • 0e4c64698f Adds ftell(), removed reading from file in fseek/ftell tests (since that modifies pointer location) Kwarde 2025-07-28 10:16:00 +02:00
  • a803a216b1 Adds fread(), fseek() Kwarde 2025-07-28 10:05:16 +02:00
  • a8bc8cfa2e Adds constants DEF_MODE_FILE and DEF_MODE_DIR Kwarde 2025-07-27 21:45:32 +02:00
  • f18de90868 1) REALLY fix strcat crash (git restored wrong file in previous commit) 2) fopen: less labels ffs Kwarde 2025-07-27 21:17:59 +02:00
  • ca6d6e6d31 Fix strcat SIGSEGV crash Kwarde 2025-07-27 21:11:53 +02:00
  • 0d1a125782 Fix return value comment of fgettype Kwarde 2025-07-27 16:29:02 +02:00
  • c40a59b4ff Adds lstat() Kwarde 2025-07-27 16:25:23 +02:00
  • 0c5bbde4a4 fgettype() test: Skip useless tests (lea/cmp/cmove) if correct filetype was detected Kwarde 2025-07-27 15:08:07 +02:00
  • 310c199942 stat buffer fields: add comments (unsigned) and '4 bytes' for non-qword values. Kwarde 2025-07-27 14:52:42 +02:00
  • 40583103a1 Add (basic) tests for stat(), fgettype(), fgetmod() Kwarde 2025-07-27 14:49:24 +02:00
  • efd35b2957 fstatat -> stat, fgettype/fgetmod: rax->eax (st_mode is dword, not qword) Kwarde 2025-07-27 14:19:09 +02:00
  • dbf2af0253 Adds fgetat,fgettype,fgetmod. Seperates constants to multiple files Kwarde 2025-07-27 14:11:44 +02:00
  • 5b6831a501 __INTERNAL_fmt: Exit if syscall NR_write fails (which is very likely if called through fwrite with an invalid FD) Kwarde 2025-07-26 01:10:34 +02:00
  • e8b47fff6d __INTERNAL_fmt: Assure correct stack arguments are loaded if FD=stderr Kwarde 2025-07-26 01:07:42 +02:00
  • 69d7a52c62 Adds eprintf (printf but print to stderr) Kwarde 2025-07-26 00:57:30 +02:00
  • 8a18695328 __INTERNAL_fmt: Add description + return with errno -EBADF if FD is lower than FD_stdout (1) Kwarde 2025-07-26 00:50:09 +02:00
  • fdef1ed7b6 fwrite test 4: do not reopen file Kwarde 2025-07-26 00:21:37 +02:00
  • 6b45b84ab1 printf->__INTERNAL_fmt. FD passed via RAX. fwrite now allows specifiers and variable arguments. Kwarde 2025-07-26 00:20:25 +02:00
  • d713fdf556 Fix minor test message mistakes Kwarde 2025-07-25 14:45:18 +02:00
  • 5434e48ee4 Adds fwrite() Kwarde 2025-07-25 14:16:20 +02:00
  • a7c1c6bdb5 Add *.txt to make clean Kwarde 2025-07-25 12:02:28 +02:00
  • 31bda18649 Fix test message fopen2 (==>fopen1) Kwarde 2025-07-25 12:01:43 +02:00
  • 1fac6f92ef Adds fopen() and fexist() and tests for all existing functions Kwarde 2025-07-25 11:56:13 +02:00
  • 490f287c09 Add tests for umask_get() and umask_set() Kwarde 2025-07-25 11:13:25 +02:00
  • 511be406be Add tests for existing functions (except file functions) Kwarde 2025-07-25 11:04:41 +02:00
  • 6cfb1b6f5f printf fix: Decrease rdi if padding is not 0 and specifier is invalid (assure '%' is printed) Kwarde 2025-07-24 22:20:47 +02:00
  • bb69efcc37 Update printf test 1; Add '%9l'; I realized that I fixed '%0(invalid)' but that in the same scenario, non-zero would still cause that specific bug Kwarde 2025-07-24 22:19:31 +02:00
  • 5c395894c6 Remove '(root)/file.asm Kwarde 2025-07-24 21:09:22 +02:00
  • 1f548fddf5 Add tests for strlen Kwarde 2025-07-24 21:09:07 +02:00
  • 7c46988508 FIX printf: '%0(invalid)' as-is (don't exclude '%') Kwarde 2025-07-24 20:32:49 +02:00
  • 89b50c83ba Fix last perror test Kwarde 2025-07-24 16:30:06 +02:00
  • 715f944b6b Fix return value of perror (original -errno was returned as errno) Kwarde 2025-07-24 16:27:34 +02:00
  • eb1c714127 Optimize umask_get (make it a leaf function) Kwarde 2025-07-24 15:23:25 +02:00
  • c2535d9240 file.asm: Make sure constants are defined as octal Kwarde 2025-07-24 15:10:38 +02:00
  • ee0fe3b304 Add missing defined functions in src/tests.asm Kwarde 2025-07-24 15:06:34 +02:00
  • 58190e3f48 Remove leftover file 'test' (used in silent umask tests) Kwarde 2025-07-24 14:56:35 +02:00
  • fc297959ab Start writing file functions Kwarde 2025-07-24 14:56:12 +02:00
  • 19cea5642b perror: don't overwrite rax if rax=0 (mov rax,r9 before .quit) Kwarde 2025-07-22 15:57:53 +02:00
  • bc5e6e2342 Adds perror() Kwarde 2025-07-22 15:54:25 +02:00
  • 8f4f0a83f5 FIX printf: NL and TAB not being counted in amount of printed chars Kwarde 2025-07-22 06:55:08 +02:00
  • d15ed616e9 atoi: Prevent (unsigned) overflow Kwarde 2025-07-22 06:45:46 +02:00
  • 53b5314d68 Fix expected return value for 1st printf test Kwarde 2025-07-21 17:35:59 +02:00
  • c69bd8332e Add tests print(),puts(), start adding tests for printf() Kwarde 2025-07-21 17:20:55 +02:00
  • 03303a303e Wrappers (%define) for macro assert Kwarde 2025-07-21 16:55:42 +02:00
  • d167dfdcdf Add TEST clampu, better test result overview Kwarde 2025-07-21 16:40:45 +02:00
  • e8b48e9939 FIX unsigned test outputs: %d -> %u Kwarde 2025-07-21 16:33:07 +02:00
  • 51fc8d5608 FIX tests minu,maxu: ...UEqual, not ...IEqual Kwarde 2025-07-21 16:30:19 +02:00
  • 1b3f4c1b99 TEST clamp() Kwarde 2025-07-21 16:29:22 +02:00
  • 9641ed1480 TEST max,maxu (shameless copy,paste,replace) Kwarde 2025-07-21 16:23:40 +02:00
  • 621de1c3db TEST minu(), improved test outputs, default to only showing full output on failure Kwarde 2025-07-21 16:20:44 +02:00
  • f8dc652501 Fix %if statement (TEST_tolower => TEST_islower) Kwarde 2025-07-21 16:09:22 +02:00
  • d14b90ffef Fix min() tests Kwarde 2025-07-21 16:06:28 +02:00
  • 34de8f351d Tests: print expected return value and real return value. Also allow printing this only for failed tests (preventing more output to console) Kwarde 2025-07-21 16:04:25 +02:00
  • ad559062ef Start rewriting tests Kwarde 2025-07-21 15:33:54 +02:00
  • 7db299bcbd printf test 18: atoi->itoa Kwarde 2025-07-21 00:30:17 +02:00
  • 336a178d30 Revert "utoa: call clampu instead of clamp (since utoa=>unsigned to ascii)" -- it's for padding length, max 64, no unsigned tests needed... Kwarde 2025-07-20 23:55:01 +02:00
  • e00895105c utoa: call clampu instead of clamp (since utoa=>unsigned to ascii) Kwarde 2025-07-20 23:48:07 +02:00
  • d595ba1903 Little update in printf comment (padding now does take num prefix into account) Kwarde 2025-07-20 23:39:54 +02:00
  • 8c25b7913b printf(): Print null pointers (arg for %s = 0) as (null), fixes #4 Kwarde 2025-07-20 22:51:01 +02:00
  • ebee21c457 mov X, 0 -> xor X, X - Fixes #3 Kwarde 2025-07-20 22:38:06 +02:00
  • 6bc6000454 printf: Prevent special characters not being processed if it was proceeded by a percentage sign (ie '%\n') Kwarde 2025-07-20 12:35:13 +02:00
  • b0e9193b0a atoi(): Add support for lowercase hexadecimal letters Kwarde 2025-07-20 12:18:29 +02:00
  • 318ccc960f atoi(): Remove leftover label .getLen Kwarde 2025-07-20 11:50:03 +02:00
  • aef72931a3 atoi(): Don't use extra loop for calculating base^n; r9 already holds previous value so just do r9*rsi ( [previous base^n] * base) Kwarde 2025-07-20 11:47:31 +02:00
  • 3510139c25 Add tests for atoi() Kwarde 2025-07-20 11:41:20 +02:00
  • 4ed0ae373c Adds atoi Kwarde 2025-07-20 11:33:07 +02:00
  • 1c5ba65f49 Correctly set padding length when using prefix (fixes #1) Kwarde 2025-07-17 14:56:35 +02:00
  • 09cf143b2a Fix printf comment: %8x->%#8x Kwarde 2025-07-16 13:25:59 +02:00
  • bb53e7967d Account for padding length when inserting prefix while padding with spaces Kwarde 2025-07-16 13:24:24 +02:00
  • 0a737dc0e5 Use r13 only instead of r13+r15 (bitmasking) Kwarde 2025-07-15 21:34:36 +02:00
  • 3978805d8f Extra test for %p (or rather prefix+padding): prefix taken into account for padding spaces but not for zeroes. Kwarde 2025-07-15 16:57:53 +02:00
  • 53f9c1e2f7 Fix tests for printf %p: Don't use random magic number but actual pointers, since that's what %p is for) Kwarde 2025-07-15 16:50:00 +02:00
  • e718e1534b printf: Add format specifier %p Kwarde 2025-07-15 16:39:19 +02:00
  • 70ab8b19c3 Allow printing prefixes for %x,%X,%b and %o (pass ~base to udec) Kwarde 2025-07-15 16:31:52 +02:00
  • 87fd5d815a Update supported padding specifiers comment (include o[ctal]) Kwarde 2025-07-15 10:52:09 +02:00
  • a4855c3b75 printf: Macro process_arg to decrease repeated code Kwarde 2025-07-15 10:45:01 +02:00
  • 351f8058f9 Replace old X2str references in src/tests.asm Kwarde 2025-07-15 08:58:03 +02:00
  • 7caa050b71 Revert src/tests.asm (%000064b -> %064b). Was a quick test (assure pad num is calculated correctly with multiple zeroes) Kwarde 2025-07-15 08:56:49 +02:00
  • 920522e167 printf: increase arg counter (r14) for invalid specifiers, as it's supposed to do (according to func doc) Kwarde 2025-07-15 08:55:37 +02:00
  • e593ce76d3 Update supported specifiers in printf comment Kwarde 2025-07-15 08:19:27 +02:00
  • dc49e29019 utoa/printf: Support octal (%o) Kwarde 2025-07-15 08:18:57 +02:00
  • 9f33e36883 Rewrite X2str functions to itoa/utoa ; it was a stupid idea to have seperate functions (=> more maintenance) Kwarde 2025-07-15 07:58:18 +02:00