beep beeeeep | you're crushing my apartment with your vehicle, human | so to these asm boughs I shall give my soul to keep | petals, my shroud gently carry me to sleep | murmurs and other tales
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Luiserebii 49e27f2ec1
Minor changes, minor additions
11 meses atrás
.circleci Added these meta-tests for CircleCI 11 meses atrás
docs Minor changes, minor additions 11 meses atrás
src Minor bug caught, forgot to return exit code from test_end() 11 meses atrás
test Added these meta-tests for CircleCI 11 meses atrás
.gitignore Test written and generally working, now to integrate in CircleCI 11 meses atrás
LICENSE.md Adding LICENSE.md 11 meses atrás
Makefile Updating name to Mint-x86asm32 11 meses atrás
README.md Minor changes, minor additions 11 meses atrás

README.md

Mint-x86asm32

GitHub CircleCI

A minimal test framework for x86 ASM (32-bit).

Installation

Running make will create a libmintx86asm32.so library to link against in the build/ directory. For static linking, build/ should be populated also with the respective .o object files needed.

Usage

Using Mint is simple. The basic flow of a test program using Mint:

  1. Call assertions.
  2. Return with test_end() to clean up by calling it and forwarding the return value as the exit code.

Mint exposes the following functions for use in testing:

test_assert(int32_t cond, char* title)
test_assert_true(int32_t cond, char* title)
test_assert_false(int32_t cond, char* title)

test_assert_equal(int32_t val, int32_t exp, char* title)
test_assert_equal_uint(int32_t val, int32_t exp, char* title)
test_assert_equal_bin(int32_t val, int32_t exp, char* title)
test_assert_equal_oct(int32_t val, int32_t exp, char* title)
test_assert_equal_hex(int32_t val, int32_t exp, char* title)

test_assert_equal_string(char* s, char* exp, char* title)
test_assert_equal_string_len(char* s, char* exp, int32_t n, char* title)
test_assert_equal_memory(void* ptr, void* exp, int32_t n, char* title)

test_end()

This library follows the C calling convention, and each function expects arguments on the stack to process and clean up correctly.

Documentation

Documentation can be found by checking the docs/ directory.

Expected output

The general formatting of each function follows these patterns:

  [SUCCESS] strlen() returns num
  [FAIL] strlen() returns num: Expected true, found false ("[NUM]")
  [FAIL] isbool() returns true: Expected false, found true ("[NUM]")
  [FAIL] sums are equal: Expected "[NUM]", found "[NUM]"
  [FAIL] sums are equal: Expected "01010", found "01111"
  [FAIL] sums are equal: Expected "0[NUM]", found "0[NUM]"
  [FAIL] sums are equal: Expected "0x[NUM]", found "0x[NUM]"
  [FAIL] strings are equal: Expected "[STR]", found "[STR]"
  [FAIL] memory arrs are equal: Expected "0x[NUM]" on [N]th byte, found "0x[NUM]"

[FAIL] [NUM] tests failing with [NUM] tests passing.
[SUCCESS] All tests ([NUM]) passing with no tests failing.

For a particular set of test cases, output may look as follows:

string.h
  [SUCCESS] strlen() returns num
  [SUCCESS] strlen() returns num
  [FAIL] strlen() returns num: Expected true, found false ("0")
  [FAIL] strlen() returns num: Expected false, found true ("1")
  [FAIL] strlen() returns num: Expected false, found true ("1024")
  [FAIL] strlen() returns num: Expected "100", found "200"
  [FAIL] strlen() returns num: Expected "1100100", found "11001000"
  [FAIL] strlen() returns num: Expected "0144", found "0310"
  [FAIL] strlen() returns num: Expected "0x64", found "0xC8"
  [FAIL] strlen() returns num: Expected "aac", found "aaa"
  [FAIL] strlen() returns num: Expected "0x63" on 12th byte, found "0x61"
  [FAIL] strlen() returns num: Expected "0x5A" on 20th byte, found "0x7A"

[FAIL] 10 tests failing with 2 tests passing.

Testing

Run make && ./a.out in the test/ directory to test, which will run through functions and produce reasonable output.

License

This code has been licensed under the GNU General Public License v3.0.