Assert file

This commit is contained in:
Imbus 2025-02-14 04:13:23 +01:00
parent 120a61eca7
commit 52857830ac
2 changed files with 27 additions and 0 deletions

25
assert.h Normal file
View file

@ -0,0 +1,25 @@
#pragma once
#include <stdint.h>
#include <stdio.h>
#define ASSERTold(expr) \
do { \
if (!(expr)) { \
printf("ASSERTION FAILED: %s at %s:%d\n", #expr, __FILE__, \
__LINE__); \
while (1); \
} \
} while (0)
#define ASSERT_EQ(expr, expected) \
do { \
uint64_t result = (expr); \
if (result != (expected)) { \
printf("ASSERTION FAILED: %s at %s:%d\n", #expr, __FILE__, \
__LINE__); \
printf("Expected: %lu, Got: %lu\n", (unsigned long)(expected), \
(unsigned long)result); \
while (1); \
} \
} while (0)

2
main.c
View file

@ -1,8 +1,10 @@
#include "assert.h"
#include <ch32fun.h>
#include <rand.h>
#include <rsa.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define LED_PIN PD6