Tell me how to do a unit test in C language, samples, and experiences!

Asked 1 years ago, Updated 1 years ago, 115 views

Hello.

I'm a beginner developer. I want to do a unit test while doing a socket program with c in the centos Linux environment, so I am posting a question like this.

Could you briefly tell me the Unit Test framework and how to use it in the C language environment?

I'm practicing socket programming with Eclipse in CentOS.

When testing the functions for normal operation, It was difficult to create main functions every time, and it was difficult to manage the files of the main functions.

I searched C Unit Test on Google.

http://stackoverflow.com/questions/65820/unit-testing-c-code I was able to find the same article as above.

Among them, I installed a tool called check and followed the document I didn't succeed because of my lack of English, and I need to understand another tool.

Could you please let me know if there is a sample or a document in Korean that I can follow? I would appreciate it more if you could tell me your experience of using it yourself.

c unit-testing centos linux

2022-09-22 13:02

1 Answers

The one I used recently is the Google test.

The libraries written in c++ had to operate on Windows/Linux respectively, so I tried it as a test framework and it's okay.

Similar to a typical xUnit, you can include gtest.h and write setup test teardown.

https://github.com/google/googletest


2022-09-22 13:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.