Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions test/functions/StructIsOrdered.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {

function beforeAll() {
variables.orderedStruct = structNew(type = "ordered");
variables.orderedStruct.a = 1;
variables.orderedStruct.b = 2;
variables.unorderedStruct = structNew();
variables.unorderedStruct.a = 1;
variables.unorderedStruct.b = 2;
variables.emptyOrderedStruct = structNew(type = "ordered");
variables.emptyUnorderedStruct = structNew();
variables.orderedStructLiteral = [one=1, two=2, three=6, four=4];
variables.unorderedStructLiteral = {one=1, two=2, three=6, four=4};
}

function run(testResults, testBox) {

describe("Testcases for StructIsOrdered() BIF", function() {
it(title = "should return true for ordered struct", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.orderedStruct)).toBeTrue();
});

it(title = "should return false for unordered struct", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.unorderedStruct)).toBeFalse();
});

it(title = "should return false for unordered struct (literal syntax)", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.unorderedStructLiteral)).toBeFalse();
});

it(title = "should return true for ordered struct (literal syntax)", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.orderedStructLiteral)).toBeTrue();
});

it(title = "should return true for empty ordered struct", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.emptyOrderedStruct)).toBeTrue();
});

it(title = "should return false for empty unordered struct", skip = true, body = function(currentSpec) {
expect(StructIsOrdered(variables.emptyUnorderedStruct)).toBeFalse();
});
});

describe("Testcases for isOrdered() - Member Function", function() {
it(title = "should return true for ordered struct (member)", skip = true, body = function(currentSpec) {
expect(variables.orderedStruct.isOrdered()).toBeTrue();
});

it(title = "should return false for unordered struct (member)", skip = true, body = function(currentSpec) {
expect(variables.unorderedStruct.isOrdered()).toBeFalse();
});

it(title = "should return false for unordered struct (literal syntax) (member)", skip = true, body = function(currentSpec) {
expect(variables.unorderedStructLiteral.isOrdered()).toBeFalse();
});

it(title = "should return true for ordered struct (literal syntax) (member)", skip = true, body = function(currentSpec) {
expect(variables.orderedStructLiteral.isOrdered()).toBeTrue();
});

it(title = "should return true for empty ordered struct (member)", skip = true, body = function(currentSpec) {
expect(variables.emptyOrderedStruct.isOrdered()).toBeTrue();
});

it(title = "should return false for empty unordered struct (member)", skip = true, body = function(currentSpec) {
expect(variables.emptyUnorderedStruct.isOrdered()).toBeFalse();
});
});

}
}
Loading