// Copyright 2020 - present Alex Dukhno
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use super::*;

#[test]
fn arithmetic() {
    assert_eq!(
        Operation::Arithmetic(Arithmetic::Add).acceptable_operand_types(),
        vec![(GeneralType::Number, GeneralType::Number)]
    );
}

#[test]
fn bitwise() {
    assert_eq!(
        Operation::Bitwise(Bitwise::ShiftLeft).acceptable_operand_types(),
        vec![(GeneralType::Number, GeneralType::Number)]
    );
}

#[test]
fn comparison() {
    assert_eq!(
        Operation::Comparison(Comparison::Eq).acceptable_operand_types(),
        vec![
            (GeneralType::Bool, GeneralType::Bool),
            (GeneralType::Number, GeneralType::Number),
            (GeneralType::String, GeneralType::String)
        ]
    );
}

#[test]
fn logical() {
    assert_eq!(
        Operation::Logical(Logical::Or).acceptable_operand_types(),
        vec![(GeneralType::Bool, GeneralType::Bool)]
    );
}

#[test]
fn string_op() {
    assert_eq!(
        Operation::StringOp(StringOp::Concat).acceptable_operand_types(),
        vec![(GeneralType::String, GeneralType::String)]
    );
}

#[test]
fn pattern_matching() {
    assert_eq!(
        Operation::PatternMatching(PatternMatching::Like).acceptable_operand_types(),
        vec![(GeneralType::String, GeneralType::String)]
    );
}
