Skip to content

Commit df6dc48

Browse files
committed
Add assign test
1 parent 1ae3873 commit df6dc48

File tree

1 file changed

+9
-56
lines changed

1 file changed

+9
-56
lines changed

src/test/json_pointer_test.h

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -267,56 +267,9 @@ namespace format
267267
TEST_IT_END
268268
}
269269

270-
/* TODO: ???? void
271-
test_point ()
270+
TEST_F (json_pointer_test, point_assign)
272271
{
273-
format::json j ( L"{ \"foo\": [\"bar\", \"baz\"],\
274-
\"\": 0,\
275-
\"a/b\": 1,\
276-
\"c%d\": 2,\
277-
\"e^f\": 3,\
278-
\"g|h\": 4,\
279-
\"i\\j\": 5,\
280-
\" \": 7,\
281-
\"m~n\": 8 }" );
282-
283-
// FIXME: \"k\"l\": 6 parse error
284-
285-
struct assert
286-
{
287-
const wchar_t *ref_token;
288-
value::value_t type;
289-
long num_val;
290-
int assert_status;
291-
};
292-
293-
std::vector<struct assert > test = {
294-
{ L"", value::value_t::object_t, 0, PASS },
295-
{ L"/foo", value::value_t::array_t, 0, PASS },
296-
{ L"/foo/-", value::value_t::undefined_t, 0, PASS },
297-
{ L"/not", value::value_t::undefined_t, 0, PASS },
298-
{ L"/not/found", value::value_t::undefined_t, 0, FAIL },
299-
};
300-
301-
TEST_IT_START
302-
303-
format::value & v = j.point ((*it).ref_token);
304-
ASSERT_EQUAL_IDX ("point type", (*it).type, v.type ());
305-
306-
if (v.type () == value::number_t)
307-
{
308-
format::number & n = static_cast<format::number &> (v);
309-
ASSERT_EQUAL_IDX ("point numeric value", (*it).num_val, static_cast<long> (n.get ()));
310-
}
311-
312-
TEST_IT_END
313-
} */
314-
315-
/* TODO: void
316-
test_point_assign ()
317-
{
318-
format::json j ( L"{ \"foo\": [],\
319-
\"bar\": {} }" );
272+
format::json j ( L"{ \"foo\": [],\"bar\": {} }" );
320273

321274
struct assert
322275
{
@@ -327,27 +280,27 @@ namespace format
327280
};
328281

329282
std::vector<struct assert > test = {
330-
{ { L"/foo/-", L"/foo/0" }, 1, value::value_t::number_t, PASS },
331-
{ { L"/foo/0", L"/foo/0" }, 2, value::value_t::number_t, PASS },
332-
{ { L"/bar/quux", L"/bar/quux" }, 3, value::value_t::number_t, PASS },
333-
{ { L"/not/found", L"/not/found" }, 4, value::value_t::undefined_t, FAIL },
283+
{ { L"/foo/-", L"/foo/0" }, 1, value::value_t::number_t, T_PASS },
284+
{ { L"/foo/0", L"/foo/0" }, 2, value::value_t::number_t, T_PASS },
285+
{ { L"/bar/quux", L"/bar/quux" }, 3, value::value_t::number_t, T_PASS },
286+
{ { L"/not/found", L"/not/found" }, 4, value::value_t::undefined_t, T_FAIL },
334287
};
335288

336289
TEST_IT_START
337290

338291
j.point ((*it).ref_token[0]) = (*it).new_val;
339292
format::value & v = j.point ((*it).ref_token[1]);
340293

341-
ASSERT_EQUAL_IDX ("point type", (*it).type, v.type ());
294+
ASSERT_EQ ((*it).type, v.type ());
342295

343296
if (v.type () == value::number_t)
344297
{
345298
format::number & n = static_cast<format::number &> (v);
346-
ASSERT_EQUAL_IDX ("point numeric value", (*it).new_val, static_cast<long> (n.get ()));
299+
ASSERT_EQ ((*it).new_val, static_cast<long> (n.get ()));
347300
}
348301

349302
TEST_IT_END
350-
} */
303+
}
351304

352305
} // namespace test
353306
} // namespace format

0 commit comments

Comments
 (0)