You've already forked sentry-native
mirror of
https://github.com/encounter/sentry-native.git
synced 2026-03-30 11:37:49 -07:00
e995329629
* fix: Correct wrong slice comparison * add explicit slice tests
22 lines
577 B
C
22 lines
577 B
C
#include "sentry_slice.h"
|
||
#include "sentry_testsupport.h"
|
||
#include <sentry.h>
|
||
|
||
SENTRY_TEST(slice)
|
||
{
|
||
char buf[] = "my string buffer";
|
||
char sbuf[] = "string";
|
||
|
||
// we don’t have explicit slicing functions, so create the slices manually
|
||
sentry_slice_t my = { buf, 2 };
|
||
sentry_slice_t str1 = { buf + 3, 6 };
|
||
sentry_slice_t str2 = { sbuf, 6 };
|
||
|
||
TEST_CHECK(sentry__slice_eq(str1, str2));
|
||
TEST_CHECK(!sentry__slice_eq(str1, my));
|
||
|
||
char *owned = sentry__slice_to_owned(str1);
|
||
TEST_CHECK_STRING_EQUAL(owned, "string");
|
||
sentry_free(owned);
|
||
}
|