use super::{line_col, Location};

#[test]
fn should_line_col_empty_str() {
    let json = "";
    let Location { line, col } = line_col(json);
    assert_eq!(line, 0);
    assert_eq!(col, 0);
}

#[test]
fn should_line_col_one_line_one_char_str() {
    let json = "1";
    let Location { line, col } = line_col(json);
    assert_eq!(line, 0);
    assert_eq!(col, 1);
}

#[test]
fn should_line_col_one_line_many_chars_str() {
    let json = "1234";
    let Location { line, col } = line_col(json);
    assert_eq!(line, 0);
    assert_eq!(col, 4);
}

#[test]
fn should_line_col_two_line_one_col_str() {
    let json = "1234\n1";
    let Location { line, col } = line_col(json);
    assert_eq!(line, 1);
    assert_eq!(col, 1);
}
