We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这样传参的话:EXPECT_FALSE(lept_get_boolean(&v)) lept_get_boolean() 正常情况下返回 LEPT_FALSE(1) 而宏展开则是 (actual) == 0, 应该是 (actual) == 1 才符合测试。
The text was updated successfully, but these errors were encountered:
你好,我觉得你可能对lept_get_boolean()返回值有点误解, lept_get_boolean()返回的应该是,v所代表的布尔值对应的 0或1, 而不是 LEPT_FALSE 或者 LEPT_TRUE 这可以从这个函数的返回值看出来,返回的是int,而不是 lept_type 具体我是这样实现的,这样EXPECT_FALSE没问题 int lept_get_boolean(const lept_value* v) { /* \TODO */ assert(v->type == LEPT_TRUE || v->type == LEPT_FALSE); return v->type == LEPT_TRUE ? 1 : 0; }
Sorry, something went wrong.
这样啊,那我理解错了...
@chanchancl 可以直接写成 return v->type == LEPT_TRUE; 吧 😄 当然, 你这样写清晰一些.
return v->type == LEPT_TRUE;
No branches or pull requests
这样传参的话:EXPECT_FALSE(lept_get_boolean(&v))
lept_get_boolean() 正常情况下返回 LEPT_FALSE(1)
而宏展开则是 (actual) == 0,
应该是 (actual) == 1 才符合测试。
The text was updated successfully, but these errors were encountered: