visual studio project

This commit is contained in:
2022-03-28 00:32:46 +03:00
parent 5bc866cf3e
commit c1d004f411
32 changed files with 1010 additions and 386 deletions

View File

@@ -1,15 +1,5 @@
#include "../base/base.h"
#include "tests.h"
#include "../Hashtable/KeyValuePair.h"
KeyValuePair test_marshalling(char* text){
//printf("<%s>\n", text);
Unitype u={.VoidPtr=text,.type=CharPtr};
KeyValuePair msg={"message",u};
return msg;
}
void test_all(){
test_searchtree();
test_autoarr();

View File

@@ -2,8 +2,9 @@
#include "../Autoarr/Autoarr.h"
static void printautoarr(Autoarr(uint16)* ar){
printf("\e[94mAutoarr(uint16): %lu\n"
" max_blocks_count: %u\n"
printf("\e[94mAutoarr(uint16): "
IFWIN("%llu", "%lu")
"\n max_blocks_count: %u\n"
" blocks_count: %u\n"
" max_block_length: %u\n"
" block_length: %u\n"

View File

@@ -2,8 +2,9 @@
#include "../Hashtable/Hashtable.h"
void print_hashtable(Hashtable* ht){
printf("\e[94mHashtable:%lu\n"
" hein: %u\n"
printf("\e[94mHashtable: "
IFWIN("%llu", "%lu")
"\n hein: %u\n"
" height: %u\n"
" rows: %p\n",
sizeof(Hashtable),

14
tests/test_marshalling.c Normal file
View File

@@ -0,0 +1,14 @@
#include "../Hashtable/KeyValuePair.h"
EXPORT void CALL test_marshalling(char* text, KeyValuePair** kptr){
KeyValuePair* k=malloc(sizeof(KeyValuePair));
k->key="message";
char* tc=cptr_copy(text);
Unitype u={.VoidPtr=tc, .type=CharPtr};
k->value=u;
*kptr=k;
}
EXPORT void CALL pinvoke_print(char* msg) {
printf("printed from unmanaged code: %s\n", msg);
}

View File

@@ -1,13 +0,0 @@
#pragma once
#if __cplusplus
extern "C" {
#endif
#include "../Hashtable/KeyValuePair.h"
KeyValuePair test_marshalling(char* text);
#if __cplusplus
}
#endif

View File

@@ -2,7 +2,9 @@
#include "../SearchTree/SearchTree.h"
void printstnode(STNode* node){
printf("\e[94mSTNode: %lu\n address: %p\n value: ",sizeof(STNode),node);
printf("\e[94mSTNode: "
IFWIN("%llu", "%lu")
"\n address: %p\n value: ",sizeof(STNode),node);
printuni(node->value);
// prints pointers to all existing branches
printf("\n branches: %p\n", node->branches);

View File

@@ -8,8 +8,8 @@ void test_string(){
string s=string_cpFromCharPtr(c);
printf("\e[92m\"%s\" -> string_cpFromCharPtr()\n",c);
if(s.length!=16) throw("string created with incorrect length");
char* p=string_cpToCharPtr(s);
printf("\e[92mstring_cpToCharPtr() -> \"%s\"\n",p);
char* p=string_cpToCptr(s);
printf("\e[92mstring_cpToCptr() -> \"%s\"\n",p);
free(p);
free(s.ptr);
}));