forked from dogecoinfoundation/libdogecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuffer_tests.c
26 lines (23 loc) · 955 Bytes
/
buffer_tests.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**********************************************************************
* Copyright (c) 2015 Jonas Schnelli *
* Copyright (c) 2022 bluezr *
* Copyright (c) 2022 The Dogecoin Foundation *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <dogecoin/buffer.h>
void test_buffer()
{
struct const_buffer buf0 = {"data", 4};
struct const_buffer buf0a = {"data1", 5};
struct const_buffer buf1 = {"data", 4};
struct buffer* buf2;
assert(buffer_equal(&buf0, &buf1) == 1);
assert(buffer_equal(&buf0, &buf0a) == 0);
buf2 = buffer_copy(&buf0.p, buf0.len);
buffer_free(buf2);
}