local _ = require('lodash')
describe('Lang module', function()
    it('should support args', function()
        assert.is.equal('1', _.str(_.args({1, 2, 3})))
    end)
    it('should support bool', function()
        assert.is.equal(false, _.bool({1, 2, 3}))
        assert.is.equal(true, _.bool("123"))
        assert.is.equal(false, _.bool(0))
        assert.is.equal(true, _.bool(function(a) return a end, "555"))
    end)
    it('should support func', function()
        local f = _.func(1, 2, 3)
        assert.is.equal('1', _.str(f()))
    end)
    it('should support gt', function()
        assert.is.equal(false, _.gt(1, 3))
        assert.is.equal(false, _.gt(1, '3'))
        assert.is.equal(false, _.gt({}, 3))
    end)
    it('should support gte', function()
        assert.is.equal(false, _.gte(1, 3))
        assert.is.equal(true, _.gte(3, '3'))
        assert.is.equal(false, _.gte({}, 3))
    end)
    it('should support isBoolean', function()
        assert.is.equal(false, _.isBoolean('x'))
        assert.is.equal(true, _.isBoolean(false))
    end)
    it('should support isEmpty', function()
        assert.is.equal(true, _.isEmpty(true))
        assert.is.equal(true, _.isEmpty(1))
        assert.is.equal(false, _.isEmpty({1}))
        assert.is.equal(false, _.isEmpty({a=1}))
    end)
    it('should support isFunction', function()
        assert.is.equal(true, _.isFunction(function() end))
        assert.is.equal(false, _.isFunction(1))	
    end)
    it('should support isNil', function()
        assert.is.equal(true, _.isNil(variable))
        local variable = 1
        assert.is.equal(false, _.isNil(variable))
    end)
    it('should support isNumber', function()
        assert.is.equal(true, _.isNumber(1))
        assert.is.equal(false, _.isNumber('1'))
    end)
    it('should support isString', function()
        assert.is.equal(false, _.isString(1))
        assert.is.equal(true, _.isString('1'))
    end)
    it('should support isTable', function()
        assert.is.equal(false, _.isTable(1))
        assert.is.equal(true, _.isTable({'1'}))
    end)
    it('should support lt', function()
        assert.is.equal(true, _.lt(1, 3))
        assert.is.equal(false, _.lt(false, 3))
        assert.is.equal(false, _.lt({}, 3))
    end)
    it('should support lte', function()
        assert.is.equal(true, _.lte(1, 3))
        assert.is.equal(true, _.lte('3', 3))
        assert.is.equal(false, _.lte({}, 3))
    end)
    it('should support num', function()
        assert.is.equal(0, _.num({1, 2, 3})) 
        assert.is.equal(123, _.num("123"))
        assert.is.equal(1, _.num(true))
        assert.is.equal(555, _.num(function(a) return a end, "555"))
    end)
    it('should support str', function()
        assert.is.equal('{1, 2, 3, 4, {{"x", "y"}, ["k"]=2}}', _.str({1, 2, 3, 4, {k=2, {'x', 'y'}}}))
        assert.is.equal('{1, 2, 3, 4, 5}', _.str({1, 2, 3, 4, function(a) return a end}, 5))
    end)
    it('should support table', function()
        assert.is.equal('{1, 2, 3, ["n"]=3}', _.str(_.table(1, 2, 3)))
        assert.is.equal('{"123", ["n"]=1}', _.str(_.table('123')))
    end)
end)