Created
February 29, 2012 06:33
-
-
Save henrik-ch/1938560 to your computer and use it in GitHub Desktop.
find right test assertions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var q = 'http://gas-unit.googlecode.com/svn/trunk/gas-unit/gasUnit.js'; | |
var s = UrlFetchApp.fetch(q).getContentText(); | |
eval(s); | |
function runFindRightAssertions() { | |
var testFixture = new TestFixture('Tests on findRight function'); | |
testFixture.addTest( | |
"third space character in string returns 2", | |
function () { | |
this.assertAreEqual(2,findRight("VB ", " ")); | |
}); | |
testFixture.addTest( | |
"not containing character returns -1", | |
function () { | |
this.assertAreEqual(-1,findRight("VB ", "A")); | |
}); | |
testFixture.addTest( | |
"searching empty string returns -1", | |
function () { | |
this.assertAreEqual(-1,findRight("", "A")); | |
}); | |
testFixture.addTest( | |
"flipped order search returns -1", | |
function () { | |
this.assertAreEqual(-1,findRight("BA", "AB")); | |
}); | |
testFixture.addTest( | |
"searching partially matched string returns -1", | |
function () { | |
this.assertAreEqual(-1,findRight("BAQ", "BAQH")); | |
}); | |
testFixture.addTest( | |
"complete match returns 0", | |
function () { | |
this.assertAreEqual(-1,findRight("BAQH", "BAQH")); | |
}); | |
var retVal = testFixture.runTests().getResultsSummary(); | |
Logger.log(testFixture.createTextTestReport()); | |
//MailApp.sendEmail("myname@example.com", "test report", Logger.getLog(), {htmlBody: testFixture.runTests().createHtmlTestReport() }); | |
return retVal; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment