'use strict';

var grunt = require('grunt');

/*
  ======== A Handy Little Nodeunit Reference ========
  https://github.com/caolan/nodeunit

  Test methods:
    test.expect(numAssertions)
    test.done()
  Test assertions:
    test.ok(value, [message])
    test.equal(actual, expected, [message])
    test.notEqual(actual, expected, [message])
    test.deepEqual(actual, expected, [message])
    test.notDeepEqual(actual, expected, [message])
    test.strictEqual(actual, expected, [message])
    test.notStrictEqual(actual, expected, [message])
    test.throws(block, [error], [message])
    test.doesNotThrow(block, [error], [message])
    test.ifError(value)
*/

exports.image_resize = {
  setUp: function(done) {
    // setup here if necessary
    done();
  },
  resize: function(test) {
    test.expect(4);

    var actual = grunt.file.read('tmp/gnu.jpg');
    var expected = grunt.file.read('test/expected/gnu.jpg');
    test.equal(actual, expected, 'gnu.jpg should be the same file');

    actual = grunt.file.read('tmp/wikipedia.png');
    expected = grunt.file.read('test/expected/wikipedia.png');
    test.equal(actual, expected, 'wikipedia.png should be the same file');

    actual = grunt.file.read('tmp/Rhododendron.jpg');
    expected = grunt.file.read('test/expected/Rhododendron.jpg');
    test.equal(actual, expected, 'Rhododendron.jpg should be the same file');

    actual = grunt.file.read('tmp/TeslaTurbine.png');
    expected = grunt.file.read('test/expected/TeslaTurbine.png');
    test.equal(actual, expected, 'TeslaTurbine.png should be the same file');

    test.done();
  }
};

@@ -36,16 +36,87 @@
 'grunt')
+,%0A    im    = require('node-imagemagick'),%0A    async = require('async')
 ;%0A%0A/*%0A  
@@ -889,771 +889,502 @@
 var 
-actual = grunt.file.read('tmp/gnu.jpg');%0A    var expected = grunt.file.read('test/expected/gnu.jpg');%0A    test.equal(actual, expected, 'gnu.jpg should be the same file');%0A%0A    actual = grunt.file.read('tmp/wikipedia.png');%0A    expected = grunt.file.read('test/expected/wikipedia.png');%0A    test.equal(actual, expected, 'wikipedia.png should be the same file');%0A%0A    actual = grunt.file.read('tmp/Rhododendron.jpg');%0A    expected = grunt.file.read('test/expected/Rhododendron
+createTest = function(filename) %7B%0A      return function(callback) %7B%0A        im.identify('tmp/'+filename, function(err, features) %7B%0A          im.identify('test/expected/'+filename, function(err, expected) %7B%0A            test.equal(features.width, expected.width);%0A            callback();%0A          %7D);%0A        %7D);%0A      %7D;%0A    %7D;%0A%0A    async.series(%5B%0A      createTest('gnu
 .jpg')
-;
+,
 %0A    
-test.equal(actual, expected, 'Rhododendron.jpg should be the same file');%0A%0A    actual = grunt.file.read('tmp/TeslaTurbine
+  createTest('Rhododendron.jpg'),%0A      createTest('wikipedia
 .png')
-;
+,
 %0A    
-expected = grunt.file.read('test/expected/TeslaTurbine.png');%0A    test.equal(actual, expected, 'TeslaTurbine.png should be the same file');%0A%0A
+  createTest('TeslaTurbine.png'),%0A 
    
+%5D,
  tes
@@ -1389,19 +1389,19 @@
 est.done
-(
 );%0A
+%0A
   %7D%0A%7D;%0A

test only width of images, not exact bit equality