var deepCopy = require('../../../../lib/object/deep_copy');

exports['Copy deeply'] = function (test) {
    var src1 = {
            a: 1,
            b: 2,
            c: {
                d: 3,
                e: 4
            },
            f: [
                5, 6, 7
            ],
            g: new Date(),
            func: function (a, b) {
                return a + b;
            },
            get h() {
                return 'h of src1';
            },
            should: 'this is should.'
        },
        dst1 = {a: 3, c: 'abc',
            get h() {
                return 'h of src2';
            }
        };
    var closeValue = 1234;
    src1.func.subFunc = function (a, b) {
        return closeValue + a - b;
    };
    deepCopy(src1, dst1);

    console.log('!!!!', dst1.h);

    test.equal(dst1.a, 1);
    test.equal(dst1['c']['d'], 3);
    test.equal(dst1['f'].length, 3);
    test.ok(dst1.func.subFunc);
    test.equal(dst1.func(1, 2), 3);
    test.equal(dst1.func.subFunc.apply(dst1.func.subFunc, [1, 2]), 1233);
    test.done();
};