Re:Using Zig to Unit Test a C Application
by raoulj on Monday December 18, 2023 @12:12PM
(#38685259)
I've done this where I use python's ctypes library to write tests for a c codebase. This feels very similar in that it can be tricky to get the type interop correct the first time around. What other strategies/solutions do people like to use for testing their c projects?
[ Parent
| on HN ]
Re:Using Zig to Unit Test a C Application
by fredyr on Monday December 18, 2023 @02:31PM
(#38687064)
I've done a lot of CFFI with Python for this kind of testing in the past. But nowadays I'm also looking at Zig for this.
Re:Using Zig to Unit Test a C Application
by physPop on Monday December 18, 2023 @04:35PM
(#38688661)
the point of zig is that there is no FFI to get right
Re:Using Zig to Unit Test a C Application
by pastage on Tuesday December 19, 2023 @01:49AM
(#38692638)
Has the way Python handles this changed a lot in the last decades? I have never did it because I feared having to chase changes in Python and an ever changing build environment. Mostly a focus thing I knew I alone would not be the one to fix it across all build envs. At the time I was the lone Pythonista now everyone we hire is comfortable with Python so I made the wrong choice.
Re:Using Zig to Unit Test a C Application
by ColonelPhantom on Tuesday December 19, 2023 @08:51AM
(#38695487)
I think (but I'm not sure) that in Zig you can just @cInclude("header.h") or something like that? So your C types are automatically imported/converted to Zig types.