use std::path::PathBuf;
pub fn get_test_data_file_path() -> PathBuf {
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/test_lib/test_data.json");
path
}
#[derive(PartialEq, Eq, Debug)]
pub enum JsonEvent {
ArrayStart,
ArrayEnd,
ObjectStart,
ObjectEnd,
MemberName(String),
StringValue(String),
NumberValue(String),
BoolValue(bool),
NullValue,
}
pub fn get_expected_events() -> Vec<JsonEvent> {
vec![
JsonEvent::ArrayStart,
JsonEvent::ArrayStart,
JsonEvent::ArrayEnd,
JsonEvent::ArrayStart,
JsonEvent::NumberValue("1".to_owned()),
JsonEvent::ArrayEnd,
JsonEvent::ArrayStart,
JsonEvent::NumberValue("1".to_owned()),
JsonEvent::StringValue("a".to_owned()),
JsonEvent::BoolValue(true),
JsonEvent::ObjectStart,
JsonEvent::MemberName("nested".to_owned()),
JsonEvent::ArrayStart,
JsonEvent::ObjectStart,
JsonEvent::MemberName("nested2".to_owned()),
JsonEvent::ArrayStart,
JsonEvent::NumberValue("2".to_owned()),
JsonEvent::ArrayEnd,
JsonEvent::ObjectEnd,
JsonEvent::ArrayEnd,
JsonEvent::ObjectEnd,
JsonEvent::ArrayEnd,
JsonEvent::ObjectStart,
JsonEvent::ObjectEnd,
JsonEvent::ObjectStart,
JsonEvent::MemberName("name".to_owned()),
JsonEvent::NumberValue("1".to_owned()),
JsonEvent::ObjectEnd,
JsonEvent::ObjectStart,
JsonEvent::MemberName("name1".to_owned()),
JsonEvent::BoolValue(false),
JsonEvent::MemberName("name2".to_owned()),
JsonEvent::StringValue("value".to_owned()),
JsonEvent::MemberName("name1".to_owned()),
JsonEvent::NumberValue("2".to_owned()),
JsonEvent::MemberName("".to_owned()),
JsonEvent::NumberValue("3".to_owned()),
JsonEvent::ObjectEnd,
JsonEvent::StringValue("string value".to_owned()),
JsonEvent::StringValue("\0 test \n\t \\ \"".to_owned()),
JsonEvent::StringValue("unicode § ಀ ᠅ 𝄆".to_owned()),
JsonEvent::NumberValue("0".to_owned()),
JsonEvent::NumberValue("-1234".to_owned()),
JsonEvent::NumberValue("567.89".to_owned()),
JsonEvent::NumberValue("100e-10".to_owned()),
JsonEvent::NumberValue("6.070e+05".to_owned()),
JsonEvent::BoolValue(true),
JsonEvent::BoolValue(false),
JsonEvent::NullValue,
JsonEvent::ArrayEnd,
]
}