#!/usr/bin/env python3

iban_lengths = {
    'AT': 20,  # Austria
    'DE': 22,  # Germany
    'CH': 21,  # Switzerland
}

# Check the length of the IBAN
def check_iban_length(iban):
    country_code = iban[:2]
    if country_code not in iban_lengths:
        print('Country code not found')
        return False
    elif len(iban) != iban_lengths[country_code]:
        print('IBAN length is incorrect')
        return False
    else:
        return True

# Verify the IBAN; add checksum verification later
def validate_iban(iban):
    return check_iban_length(iban) 

# test code
def test_iban_validation():
    valid_ibans = [
        'AT611904300234573201',   'AT483200000012345864',   'AT611904000000320111',
        'DE89370400440532013000', 'DE44500105175407324931', 'DE75512108001245126199',
        'CH9300762011623852957',  'CH5604835012345678009',  'CH3109000000532432318'
    ]
    invalid_ibans = [
        'AT61190430023457320',   'AT12345678901234567890',   'AT6119040000003201111',
        'DE8937040044053201300', 'DE1234567890123456789012', 'DE445001051754073249311',
        'CH930076201162385295',  'CH12345678901234567890',   'CH56048350123456780091'
    ]
    for iban in valid_ibans:
        assert validate_iban(iban), \
            f"Valid IBAN failed: {iban}"
    
    for iban in invalid_ibans:
        assert not validate_iban(iban), \
            f"Invalid IBAN passed: {iban}"
    
    print("All tests passed!")

# Main code starts here
test_iban_validation()