import pytest
from Q2 import is_match

def test_empty_string():
    assert is_match("", "") == True
    assert is_match("a", "") == False
    assert is_match("", "a") == False

def test_single_character_match():
    assert is_match("a", "a") == True
    assert is_match("a", "b") == False
    assert is_match("a", ".") == True
    assert is_match("a", "*") == False

def test_dot_star_combination():
    assert is_match("aa", "a*") == True
    assert is_match("ab", ".*") == True
    assert is_match("mississippi", "mis*is*p*.") == False

def test_dot_star_edge_cases():
    assert is_match("a", ".*") == True
    assert is_match("ab", ".*c") == False
    assert is_match("", ".*") == True
    assert is_match("a", "a*") == True
    assert is_match("aa", "a*a") == True
    assert is_match("a", "a*a") == True
    assert is_match("aa", "a*a*a*") == True

def test_long_strings():
    assert is_match("a" * 1000, "a*") == True
    assert is_match("a" * 1000, "b*") == False

def test_mixed_characters():
    assert is_match("aAa", "a*a") == False
    assert is_match("AaA", ".*") == True

def test_complex_patterns():
    assert is_match("aaaab", "a*a*a*b") == True
    assert is_match("abcd", ".*..d*") == True

def test_nested_star():
    assert is_match("abcde", "a.*c.*e") == True

def test_complex_cases():
    assert is_match("aaaaab", "a*a*a*a*a*c") == False
    assert is_match("aaaaac", "a*a*a*a*a*c") == True
