You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "PsiACE (via GitHub)" <gi...@apache.org> on 2023/03/16 07:36:29 UTC

[GitHub] [incubator-opendal] PsiACE commented on a diff in pull request #1632: feat(bindings/c): basic read and write op, a dirty way

PsiACE commented on code in PR #1632:
URL: https://github.com/apache/incubator-opendal/pull/1632#discussion_r1138233398


##########
bindings/c/tests/test.c:
##########
@@ -18,7 +18,34 @@
  */
 #include "opendal.h"
 
-int main(int argc, char *argv[]) {
-    hello_opendal();
-    return 0;
+#include <stdio.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+static void test_hello_opendal(void **state)
+{
+	(void)state; /* unused */
+
+	hello_opendal();
+}
+
+static void test_blocking_op(void **state)
+{
+	(void)state; /* unused */
+
+	BlockingOperator *op = blocking_op_create();
+	DynArray wbs = {"hello, world!", 13};
+	blocking_write(op, "opendal", &wbs);
+	DynArray rbs = blocking_read(op, "opendal");
+	printf("%s\n", rbs);
 }
+
+int main(int argc, char **argv)
+{
+
+	const struct CMUnitTest tests[] = {
+		cmocka_unit_test(test_hello_opendal),

Review Comment:
   I would remove it, and unless we have something complicated, there are totally simpler ways to do it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org