I have a function in a module which has multiple function clauses for the same function name but different function arities.
Example:
-module(module_name).
-export([func/1, func/2, func/3]).
func(N) ->
N.
func(N, K) ->
N * K.
func(N, K, M) ->
N * K * M.
I would like to mock this function for testing purposes so that instead of multiplying the numbers it adds them.
I know how to mock a function only for one arity:
1> meck:expect(module_name, func, fun(N, K, M) -> N + K + M end).
But how can I mock it for multiple arities?