<commit_before>local wrap     = require "wrap"
local wrapDefs = wrap.wrapMachineDefs

describe("Unit definition wrapper", function()
    it("should error if no processing function is provided", function()
        local noProcessingUnit = {
            name = 'Bad Unit',
            knobs = {}
        }
        assert.has_error(function() wrapDefs(noProcessingUnit) end,
                         "Unit `Bad Unit` has no processing function")
    end)
end)<commit_msg>Add two more wrapper tests and placeholders<commit_after>local wrap     = require "wrap"
local wrapDefs = wrap.wrapMachineDefs

describe("Unit definition wrapper", function()
    it("should error if no processing function is provided", function()
        local noProcessingUnit = {
            name = 'Bad Unit',
            knobs = {}
        }
        assert.has_error(function() wrapDefs(noProcessingUnit) end,
                         "Unit `Bad Unit` has no processing function")
    end)

    it("should correctly wrap a mono effect", function()
        local inverterDefs = {
            name = 'Inverter',
            knobs = {},
            processOneSample = function(state, sample) return -sample end
        }
        local inverterUnit = wrapDefs(inverterDefs).new()
        local samples  = {0,-0.5,-1,-5, 0.5, 1}
        local expected = {0, 0.5, 1, 5,-0.5,-1}
        inverterUnit.process(samples)
        assert.are.same(samples, expected)
    end)

    it("should correctly wrap a stereo effect", function()
        local swapperDefs = {
            name = 'Stereo Swapper',
            knobs = {},
            processSamplePair = function(state, l, r) return r, l end
        }
        local swapperUnit = wrapDefs(swapperDefs).new()
        local samples  = {0, 1,   0.25, 0.5,   -1,  0}
        local expected = {1, 0,   0.5,  0.25,   0, -1}
        swapperUnit.process(samples)
        assert.are.same(samples, expected)
    end)

    pending("test knob value clamping (max/min)", function() end)
    pending("test onChange callbacks", function() end)
end)
{'fraction_non_alphanumeric': 0.11094819159335288, 'fraction_numerical': 0.016617790811339198, 'mean_word_length': 2.2338072669826223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4075282', 'n_tokens_mistral': 599, 'n_tokens_neox': 574, 'n_words': 173}