// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include "transformations/op_conversions/softplus_decomposition.hpp"

#include <gtest/gtest.h>

#include <memory>
#include <string>

#include "common_test_utils/ov_test_utils.hpp"
#include "openvino/core/model.hpp"
#include "openvino/op/add.hpp"
#include "openvino/op/exp.hpp"
#include "openvino/op/log.hpp"
#include "openvino/op/softplus.hpp"
#include "openvino/opsets/opset4_decl.hpp"
#include "openvino/pass/manager.hpp"
#include "transformations/init_node_info.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov;
using namespace testing;

TEST_F(TransformationTestsF, SoftPlusDecompositionFP32) {
    {
        auto data = std::make_shared<opset4::Parameter>(element::f32, Shape{3, 1, 2});
        auto softplus = std::make_shared<opset4::SoftPlus>(data);

        model = std::make_shared<ov::Model>(OutputVector{softplus}, ParameterVector{data});

        manager.register_pass<ov::pass::SoftPlusDecomposition>();
    }

    {
        auto input = std::make_shared<opset4::Parameter>(element::f32, Shape{3, 1, 2});
        auto exp = std::make_shared<opset4::Exp>(input);
        auto add = std::make_shared<opset4::Add>(exp, opset4::Constant::create(element::f32, Shape{1}, {1.0}));
        auto log = std::make_shared<opset4::Log>(add);

        model_ref = std::make_shared<ov::Model>(OutputVector{log}, ParameterVector{input});
    }
}

TEST_F(TransformationTestsF, SoftPlusDecompositionFP16) {
    {
        auto data = std::make_shared<opset4::Parameter>(element::f16, Shape{3, 1, 2});
        auto softplus = std::make_shared<opset4::SoftPlus>(data);

        model = std::make_shared<ov::Model>(OutputVector{softplus}, ParameterVector{data});

        manager.register_pass<ov::pass::SoftPlusDecomposition>();
    }

    {
        auto input = std::make_shared<opset4::Parameter>(element::f16, Shape{3, 1, 2});
        auto exp = std::make_shared<opset4::Exp>(input);
        auto add = std::make_shared<opset4::Add>(exp, opset4::Constant::create(element::f16, Shape{1}, {1.0}));
        auto log = std::make_shared<opset4::Log>(add);

        model_ref = std::make_shared<ov::Model>(OutputVector{log}, ParameterVector{input});
    }
}
