Skip to content

Introducing CESTER_NO_TIME#14

Merged
Thecarisma merged 4 commits intoexoticlibraries:masterfrom
nicolasnoble:cester-no-time
Jun 9, 2020
Merged

Introducing CESTER_NO_TIME#14
Thecarisma merged 4 commits intoexoticlibraries:masterfrom
nicolasnoble:cester-no-time

Conversation

@nicolasnoble
Copy link
Copy Markdown
Contributor

This one is potentially a bit controversial.

I've been trying to make cester fit into microcontrollers (see http://www.uc-sdk.net/), and it's not unusual that (1) there is no proper time keeping on these machines and (2) there is no floating point support.

This change introduces CESTER_NO_TIME, which disables all time keeping features of cester. Activating it will make it so the code will not try to (1) use time functions and (2) use doubles. If the platform that the user is targeting lacks either of these, they can easily disable the feature in order to make their tests work.

I'm almost there getting cester to work properly on PlayStation 1 :-)

image

#include <stdint.h>
#include <stdio.h>

#include "common/hardware/pcsxhw.h"
#include "common/syscalls/syscalls.h"

#undef unix
#undef __BASE_FILE__
#define CESTER_NO_MAIN
#define CESTER_NO_SIGNAL
#define CESTER_NO_TIME
static const int EXIT_SUCCESS = 0;
static const int EXIT_FAILURE = 1;
#define fprintf(stream, fmt, ...) ramsyscall_printf(fmt, __VA_ARGS__)
#include "../../third_party/libcester/include/exotic/cester.h"

CESTER_TEST(test1, test_instance,
    ramsyscall_printf("Hello world\n");
    cester_assert_equal(NULL, NULL);
)

CESTER_BODY(
int main(int argc, char** argv, char** env) {
    CESTER_REGISTER_TEST(test1);
    pcsx_exit(CESTER_RUN_ALL_TESTS(argc, argv));
    while (1);
}
)

@Thecarisma
Copy link
Copy Markdown
Member

Great works from your side, getting cester to work properly on PlayStation 1 that interesting 👍. Please add a unit test in the test folder with CESTER_NO_TIME macro defined so I can see its behavior.

@Thecarisma Thecarisma added the enhancement New feature or request label Jun 9, 2020
@nicolasnoble
Copy link
Copy Markdown
Contributor Author

Done. PTAL.

Comment thread include/exotic/cester.h Outdated
@Thecarisma
Copy link
Copy Markdown
Member

It is good to merge now. Looking forward to more contributions from you. 😃

@Thecarisma Thecarisma merged commit fc0b7f4 into exoticlibraries:master Jun 9, 2020
@nicolasnoble nicolasnoble deleted the cester-no-time branch June 9, 2020 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants