Microprocessors and Personal Computers
Resolution proposal of the exercises made within the course unit Microprocessors and Personal Computers (1st year, 2nd semester).
Testing
In order to make the testing more easy, I've developed a bunch of classes to help running unit tests for the exercises. The process is simple and explained below.
- Create the test class and include the asserts namespace located in /src/test/asserts.h, after that consider adding
using namespace asserts;
to make the procedure easier. - Declare your assembly function following this example:
extern "C" <TYPE> <FUNCTION_NAME>(<FUNCTION_ARGS>);
. Where the type is the return value of the assembly function, the FUNCTION_NAME is the name of the function declared in the .s file and the FUNCTION_ARGS are the arguments of the assembly function. - Declare each of the unit tests as a public static void function with no arguments in the created class. Example:
using namespace asserts;
class example_test {
public:
static void example() {
...
assert_eq<type>(expected, value);
}
}
- Include the unit tests class in the unit_testing.cpp file located in the /test directory and add all the unit test functions to the Test class. Example:
t.add(example_test::example);
Disclaimer
This repository contains the assembly exercises solved during the course unit. Note that some of them might contain errors and should not be used as a solution.