Notes on using Meck API (a mocking library in Erlang) which are not well documented.
% Will create a fully mocked version of existing_module until caller crashes
meck:new(ExistingModule).
% Will create a fully mocked version of existing_module even after caller crashes
meck:new(ExistingModule, [nolink]).
% Will allow you to overload existing module, keeping old functions around
meck:new(ExistingModule, [passthrough]).
% Unload mocks and revert to real module implementation
meck:unload(ExistingModule).
% Remove functions from the mock module
meck:delete(WhateverMockedModule, SomeFun, Arity).
% Get list of all function calls made to the module (in order).
History = meck:history(MockedModule).
% History will look _similar_ to an Erlang trace but with {{M, F, A}, Return} format
% e.g. where MockedModule = my_mod
% [
% {{my_mod, print, []}, ok},
% {{my_mod, sum, [1,2,3]}, 6},
% {{my_mod, copy_file, ["non_existing_file", "other_file_name"]}, error, enoent, Stack}
% ]Susan Potter
Quant
Work with me
I spent the first half of my career building risk models and market data infrastructure at BNP Paribas, Bank of America, and Citadel, then fourteen years shipping production systems at scale. Now I bring both sides to quantitative trading. If you're a trading firm, family office, or fund looking to tighten the connection between your research ideas and your production trading systems, whether that's building validation pipelines, formalizing signal logic, or getting microstructure analytics into a deployable state, I'd like to hear what you're working on. Reach me at me@susanpotter.net.