//! Tests for Expected enum variants.

use sipha_core::traits::TokenKind;
use sipha_error::expected::Expected;

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[allow(dead_code)]
enum TestToken {
    Ident,
    Number,
    Plus,
}

impl TokenKind for TestToken {
    fn is_trivia(&self) -> bool {
        false
    }
}

#[test]
fn test_expected_single() {
    let expected = Expected::Single(TestToken::Ident);
    match expected {
        Expected::Single(token) => assert_eq!(token, TestToken::Ident),
        _ => panic!("Expected Single variant"),
    }
}

#[test]
fn test_expected_set() {
    let expected = Expected::Set(&[TestToken::Ident, TestToken::Number]);
    match expected {
        Expected::Set(tokens) => {
            assert_eq!(tokens.len(), 2);
            assert_eq!(tokens[0], TestToken::Ident);
            assert_eq!(tokens[1], TestToken::Number);
        }
        _ => panic!("Expected Set variant"),
    }
}

#[test]
fn test_expected_dynamic() {
    let expected = Expected::Dynamic(vec![TestToken::Ident, TestToken::Number]);
    match expected {
        Expected::Dynamic(tokens) => {
            assert_eq!(tokens.len(), 2);
            assert_eq!(tokens[0], TestToken::Ident);
            assert_eq!(tokens[1], TestToken::Number);
        }
        _ => panic!("Expected Dynamic variant"),
    }
}
