NEURON
Sprintf.cpp
Go to the documentation of this file.
1 #include <catch2/catch_test_macros.hpp>
2 
3 #define UNIT_TESTING
4 #include "oc/wrap_sprintf.h"
5 
7 
8 TEST_CASE("buf fits", "[NEURON]") {
9  char buf[20];
10  SprintfAsrt(buf, "%s", "hello");
11  REQUIRE(strcmp(buf, "hello") == 0);
12 }
13 
14 TEST_CASE("buf too small", "[NEURON]") {
15  char buf[5];
16  char* s = strdup("hello");
17  REQUIRE_THROWS(SprintfAsrt(buf, "%s", s));
18  free(s);
19 }
TEST_CASE("buf fits", "[NEURON]")
Definition: Sprintf.cpp:8
char buf[512]
Definition: init.cpp:13
void SprintfAsrt(char(&buf)[N], const char *fmt, Args &&... args)
assert if the Sprintf format data does not fit into buf
Definition: wrap_sprintf.h:27
s
Definition: multisend.cpp:521