def test_multi_functions(self):
        """
        Test multi-functions program can be exported into multi-functions Core ML proto.
        """

        @mb.function(
            input_specs=[mb.TensorSpec((3,))],
            opset_version=ct.target.iOS18,
        )
        def func(x):
            return mb.relu(x=x)

        @mb.function(
            input_specs=[mb.TensorSpec((3,))],
            opset_version=ct.target.iOS18,
        )
        def func_1(x):
            return mb.sin(x=x)

        @mb.function(
            input_specs=[mb.TensorSpec((3,))],
            opset_version=ct.target.iOS18,
        )
        def func_2(x):
            return mb.cos(x=x)

        prog = mil.Program()
        prog.add_function("main", func)
        prog.add_function("sin", func_1)
        prog.add_function("cos", func_2)

        package_path = self.convert_and_save(prog)

        # Test the proto can be loaded back and validate the spec
        mlmodel = ct.models.MLModel(package_path, function_name="main")
        self.check_functions_description(
            mlmodel,
            expect_function_names=["main", "sin", "cos"],
            expected_default_function_name="main",
        )

        # Validate MLModel predictions for all three functions
        self.check_relu(mlmodel)
        self.check_sin(
            ct.models.MLModel(
                package_path, function_name="sin", compute_units=ct.ComputeUnit.CPU_ONLY
            )
        )
        self.check_cos(
            ct.models.MLModel(
                package_path, function_name="cos", compute_units=ct.ComputeUnit.CPU_ONLY
            )
        )

        # Validate MLModel function_name property
        assert mlmodel.function_name == "main"
        assert ct.models.MLModel(package_path, function_name="sin").function_name == "sin"
        assert ct.models.MLModel(package_path, function_name="cos").function_name == "cos"

        # Invalid function_name
        with pytest.raises(ValueError, match="function_name invalid not found in the model"):
            mlmodel = ct.models.MLModel(package_path, function_name="invalid")

        # Validate CompiledMLModel predictions for all three functions
        compiled_path = mlmodel.get_compiled_model_path()
        self.check_relu(ct.models.CompiledMLModel(compiled_path, function_name="main"))
        self.check_sin(ct.models.CompiledMLModel(compiled_path, function_name="sin"))
        self.check_cos(ct.models.CompiledMLModel(compiled_path, function_name="cos"))

        # clean up
        shutil.rmtree(package_path)

        Test multi-functions program can be exported into multi-functions Core ML proto.
        
coremltools/converters/mil/backend/mil/test_load.py