cpptest测试总结
cpptest测试总结
项目继续,持续新增中……
1.1 桩函数设置
|
桩 |
√:fun(*p) |
|
调用次数 |
static int i
= 0; |
|
桩函数参数为void类型 |
fun(void
*p) |
1.2 用例设置
|
cpptest倾向单元测试步骤 |
1.打桩 |
|
c++调试 |
#include<iostream> |
|
文件找不到路径 |
#include<direct.h> |
|
文件打开失败 |
1.不存在 |
|
字符串拷贝隐患:在拷贝前应确认拷贝内容,包括中止符,否则将越界拷贝 |
char
ca_dir[128] = " "; |
|
new失败:内存已满,申请内存过多…… |
1.int A =
new(std::nothrow)int[10]; |
|
new |
int **p =
new int*[k]; |
|
二级指针初始化 |
int *p1 =
NULL; |
|
二级数组指针初始化 |
int **p =
new int*[10]; |
|
函数运用:指针不能直接等于字符串??? |
√:fun(*p) |
|
结构体整体赋值为0 |
struct
st_a; |
|
|
c =
fun("*i am rich*"); |
|
逻辑条件 |
||:+?、-+ |
浙公网安备 33010602011771号