File tree 2 files changed +33
-12
lines changed
2 files changed +33
-12
lines changed Original file line number Diff line number Diff line change 18
18
*
19
19
*/
20
20
21
+ #include <stdlib.h>
21
22
#include "action.h"
22
23
23
- typedef struct bs_action_t * Action ;
24
-
25
- typedef enum {
26
- HASH_CHUNK ,
27
- END_THREAD
28
- } bs_action_type ;
29
-
30
- struct bs_action_t {
31
- bs_action_type type ;
32
- void * data ;
33
- };
34
-
35
24
/**
36
25
* Create a new thread message
37
26
*/
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <string.h>
3
+ #include <stdio.h>
4
+ #include <stdlib.h>
5
+ #include "action.h"
6
+
7
+ void test_action ();
8
+
9
+ int main (int argc , char * * argv )
10
+ {
11
+ printf ("Running test_action()\n" );
12
+ test_action ();
13
+
14
+ return 0 ;
15
+ }
16
+
17
+ void test_action () {
18
+ char * buffer ;
19
+ Action action ;
20
+
21
+ buffer = malloc (20 );
22
+ memcpy (buffer , "thisrandomteststring" , 20 );
23
+
24
+ action = bs_new_action (HASH_CHUNK , buffer );
25
+
26
+ assert (memcmp (action -> data , buffer , 20 ) == 0 );
27
+ assert (action -> type == HASH_CHUNK );
28
+
29
+ free (buffer );
30
+
31
+ assert (memcmp (action -> data , "thisrandomteststring" , 20 ) != 0 );
32
+ }
You can’t perform that action at this time.
0 commit comments