"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../");
test('TestParsingInvalid', () => {
    // Malformed strings.
    // @ts-ignore
    expect((0, __1.parseProfileLevelId)()).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)(' 42e01f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('4242e01f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('e01f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('gggggg')).toBeUndefined();
    // Invalid level.
    expect((0, __1.parseProfileLevelId)('42e000')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('42e00f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('42e0ff')).toBeUndefined();
    // Invalid profile.
    expect((0, __1.parseProfileLevelId)('42e11f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('58601f')).toBeUndefined();
    expect((0, __1.parseProfileLevelId)('64e01f')).toBeUndefined();
});
test('TestParsingLevel', () => {
    expect((0, __1.parseProfileLevelId)('42e01f')?.level).toBe(__1.Level.L3_1);
    expect((0, __1.parseProfileLevelId)('42e00b')?.level).toBe(__1.Level.L1_1);
    expect((0, __1.parseProfileLevelId)('42f00b')?.level).toBe(__1.Level.L1_b);
    expect((0, __1.parseProfileLevelId)('42C02A')?.level).toBe(__1.Level.L4_2);
    expect((0, __1.parseProfileLevelId)('640c34')?.level).toBe(__1.Level.L5_2);
});
test('TestParsingConstrainedBaseline', () => {
    expect((0, __1.parseProfileLevelId)('42e01f')?.profile).toBe(__1.Profile.ConstrainedBaseline);
    expect((0, __1.parseProfileLevelId)('42C02A')?.profile).toBe(__1.Profile.ConstrainedBaseline);
    expect((0, __1.parseProfileLevelId)('4de01f')?.profile).toBe(__1.Profile.ConstrainedBaseline);
    expect((0, __1.parseProfileLevelId)('58f01f')?.profile).toBe(__1.Profile.ConstrainedBaseline);
});
test('TestParsingBaseline', () => {
    expect((0, __1.parseProfileLevelId)('42a01f')?.profile).toBe(__1.Profile.Baseline);
    expect((0, __1.parseProfileLevelId)('58A01F')?.profile).toBe(__1.Profile.Baseline);
});
test('TestParsingMain', () => {
    expect((0, __1.parseProfileLevelId)('4D401f')?.profile).toBe(__1.Profile.Main);
});
test('TestParsingHigh', () => {
    expect((0, __1.parseProfileLevelId)('64001f')?.profile).toBe(__1.Profile.High);
});
test('TestParsingConstrainedHigh', () => {
    expect((0, __1.parseProfileLevelId)('640c1f')?.profile).toBe(__1.Profile.ConstrainedHigh);
});
test('TestToString', () => {
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.ConstrainedBaseline, __1.Level.L3_1))).toBe('42e01f');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.Baseline, __1.Level.L1))).toBe('42000a');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.Main, __1.Level.L3_1))).toBe('4d001f');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.ConstrainedHigh, __1.Level.L4_2))).toBe('640c2a');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.High, __1.Level.L4_2))).toBe('64002a');
});
test('TestToStringLevel1b', () => {
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.ConstrainedBaseline, __1.Level.L1_b))).toBe('42f00b');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.Baseline, __1.Level.L1_b))).toBe('42100b');
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.Main, __1.Level.L1_b))).toBe('4d100b');
});
test('TestToStringLevel1b', () => {
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('42e01f'))).toBe('42e01f');
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('42E01F'))).toBe('42e01f');
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('4d100b'))).toBe('4d100b');
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('4D100B'))).toBe('4d100b');
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('640c2a'))).toBe('640c2a');
    expect((0, __1.profileLevelIdToString)((0, __1.parseProfileLevelId)('640C2A'))).toBe('640c2a');
});
test('TestToStringInvalid', () => {
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.High, __1.Level.L1_b))).toBeUndefined();
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(__1.Profile.ConstrainedHigh, __1.Level.L1_b))).toBeUndefined();
    expect((0, __1.profileLevelIdToString)(new __1.ProfileLevelId(255, __1.Level.L3_1))).toBeUndefined();
});
test('TestParseSdpProfileLevelIdEmpty', () => {
    const profile_level_id = (0, __1.parseSdpProfileLevelId)();
    expect(profile_level_id).toBeDefined();
    expect(profile_level_id?.profile).toBe(__1.Profile.ConstrainedBaseline);
    expect(profile_level_id?.level).toBe(__1.Level.L3_1);
});
test('TestParseSdpProfileLevelIdConstrainedHigh', () => {
    const params = { 'profile-level-id': '640c2a' };
    const profile_level_id = (0, __1.parseSdpProfileLevelId)(params);
    expect(profile_level_id).toBeDefined();
    expect(profile_level_id?.profile).toBe(__1.Profile.ConstrainedHigh);
    expect(profile_level_id?.level).toBe(__1.Level.L4_2);
});
test('TestParseSdpProfileLevelIdInvalid', () => {
    const params = { 'profile-level-id': 'foobar' };
    expect((0, __1.parseSdpProfileLevelId)(params)).toBeUndefined();
});
test('TestIsSameProfile', () => {
    expect((0, __1.isSameProfile)({ foo: 'foo' }, { bar: 'bar' })).toBe(true);
    expect((0, __1.isSameProfile)({ 'profile-level-id': '42e01f' }, { 'profile-level-id': '42C02A' })).toBe(true);
    expect((0, __1.isSameProfile)({ 'profile-level-id': '42a01f' }, { 'profile-level-id': '58A01F' })).toBe(true);
    expect((0, __1.isSameProfile)({ 'profile-level-id': '42e01f' }, undefined)).toBe(true);
});
test('TestIsNotSameProfile', () => {
    expect((0, __1.isSameProfile)(undefined, { 'profile-level-id': '4d001f' })).toBe(false);
    expect((0, __1.isSameProfile)({ 'profile-level-id': '42a01f' }, { 'profile-level-id': '640c1f' })).toBe(false);
    expect((0, __1.isSameProfile)({ 'profile-level-id': '42000a' }, { 'profile-level-id': '64002a' })).toBe(false);
});
test('TestGenerateProfileLevelIdForAnswerEmpty', () => {
    expect((0, __1.generateProfileLevelIdStringForAnswer)(undefined, undefined)).toBeUndefined();
});
test('TestGenerateProfileLevelIdForAnswerLevelSymmetryCapped', () => {
    const low_level = {
        'profile-level-id': '42e015'
    };
    const high_level = {
        'profile-level-id': '42e01f'
    };
    expect((0, __1.generateProfileLevelIdStringForAnswer)(low_level, high_level)).toBe('42e015');
    expect((0, __1.generateProfileLevelIdStringForAnswer)(high_level, low_level)).toBe('42e015');
});
test('TestGenerateProfileLevelIdForAnswerConstrainedBaselineLevelAsymmetry', () => {
    const local_params = {
        'profile-level-id': '42e01f',
        'level-asymmetry-allowed': '1'
    };
    const remote_params = {
        'profile-level-id': '42e015',
        'level-asymmetry-allowed': '1'
    };
    expect((0, __1.generateProfileLevelIdStringForAnswer)(local_params, remote_params)).toBe('42e01f');
});
