use of com.squarespace.template.CodeMaker in project template-compiler by Squarespace.
the class CorePredicatesTest method testGreaterThanOrEqual.
@Test
public void testGreaterThanOrEqual() throws CodeException {
CodeMaker mk = maker();
assertTrue(GREATER_THAN_OR_EQUAL, context("1"), mk.args(" 1"));
assertTrue(GREATER_THAN_OR_EQUAL, context("3"), mk.args(" 1"));
assertTrue(GREATER_THAN_OR_EQUAL, context("-17"), mk.args(" -18"));
assertTrue(GREATER_THAN_OR_EQUAL, context("\"z\""), mk.args(" \"a\""));
assertTrue(GREATER_THAN_OR_EQUAL, context("[]"), mk.args(" []"));
assertTrue(GREATER_THAN_OR_EQUAL, context("{}"), mk.args(" 5 4"));
assertTrue(GREATER_THAN_OR_EQUAL, context("{}"), mk.args(" 5 5"));
assertFalse(GREATER_THAN_OR_EQUAL, context("-18"), mk.args(" -17"));
assertFalse(GREATER_THAN_OR_EQUAL, context("\"a\""), mk.args(" \"z\""));
assertFalse(GREATER_THAN_OR_EQUAL, context("{}"), mk.args(" 4 5"));
}
use of com.squarespace.template.CodeMaker in project template-compiler by Squarespace.
the class CorePredicatesTest method testGreaterThan.
@Test
public void testGreaterThan() throws CodeException {
CodeMaker mk = maker();
assertTrue(GREATER_THAN, context("3"), mk.args(" 1"));
assertTrue(GREATER_THAN, context("-17"), mk.args(" -18"));
assertTrue(GREATER_THAN, context("\"z\""), mk.args(" \"a\""));
assertTrue(GREATER_THAN, context("1"), mk.args(" 5 4"));
assertFalse(GREATER_THAN, context("1"), mk.args(" 1"));
assertFalse(GREATER_THAN, context("-18"), mk.args(" -17"));
assertFalse(GREATER_THAN, context("\"a\""), mk.args(" \"z\""));
assertFalse(GREATER_THAN, context("[]"), mk.args(" []"));
assertFalse(GREATER_THAN, context("1"), mk.args(" 4 5"));
}
use of com.squarespace.template.CodeMaker in project template-compiler by Squarespace.
the class CorePredicatesTest method testLessThan.
@Test
public void testLessThan() throws CodeException {
CodeMaker mk = maker();
assertTrue(LESS_THAN, context("1"), mk.args(" 2"));
assertTrue(LESS_THAN, context("-1"), mk.args(" 0"));
assertTrue(LESS_THAN, context("\"a\""), mk.args(" \"j\""));
assertTrue(LESS_THAN, context("{}"), mk.args(" 1 2"));
assertFalse(LESS_THAN, context("-17"), mk.args(" -18"));
assertFalse(LESS_THAN, context("-17"), mk.args(" -18"));
assertFalse(LESS_THAN, context("\"j\""), mk.args(" \"a\""));
assertFalse(LESS_THAN, context("[]"), mk.args(" []"));
assertFalse(LESS_THAN, context("{}"), mk.args(" 2 2"));
assertFalse(LESS_THAN, context("{}"), mk.args(" 3 2"));
}
use of com.squarespace.template.CodeMaker in project template-compiler by Squarespace.
the class ContentFormattersTest method testSquarespaceThumbnail.
@Test
public void testSquarespaceThumbnail() throws CodeException {
CodeMaker mk = maker();
Arguments args = mk.args(" 50");
String json = "\"100x200\"";
assertFormatter(SQSP_THUMB_FOR_WIDTH, args, json, "100w");
assertFormatter(SQSP_THUMB_FOR_HEIGHT, args, json, "100w");
args = mk.args(" 600");
json = "\"1200x2400\"";
assertFormatter(SQSP_THUMB_FOR_WIDTH, args, json, "750w");
assertFormatter(SQSP_THUMB_FOR_HEIGHT, args, json, "300w");
}
Aggregations