Merge with HEAD, 10472
This commit is contained in:
commit
19f703dc9b
102 changed files with 5700 additions and 2269 deletions
|
|
@ -70,6 +70,7 @@ my $pathedFile = WebGUI::Test->getTestCollateralPath($filename);
|
|||
|
||||
# Use some test collateral to create a storage location and assign it to our article
|
||||
my $storage = WebGUI::Storage->create($session);
|
||||
WebGUI::Test->storagesToDelete($storage);
|
||||
my $storedFilename = $storage->addFileFromFilesystem($pathedFile);
|
||||
my $filenameOK = is ($storedFilename, $filename, 'storage created correctly');
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ my $pathedFile = WebGUI::Test->getTestCollateralPath($filename);
|
|||
|
||||
# Use some test collateral to create a storage location and assign it to our article
|
||||
my $storage = WebGUI::Storage->create($session);
|
||||
WebGUI::Test->storagesToDelete($storage);
|
||||
my $storedFilename = $storage->addFileFromFilesystem($pathedFile);
|
||||
my $filenameOK = is ($storedFilename, $filename, 'storage created correctly');
|
||||
|
||||
|
|
@ -87,6 +88,7 @@ isa_ok($duplicateArticle, 'WebGUI::Asset::Wobject::Article');
|
|||
|
||||
my $duplicateStorageId = $duplicateArticle->get("storageId");
|
||||
my $duplicateStorage = WebGUI::Storage->get($session,$duplicateStorageId);
|
||||
WebGUI::Test->storagesToDelete($duplicateStorage);
|
||||
my $duplicateFilename = $duplicateStorage->getFiles->[0];
|
||||
|
||||
is ($duplicateFilename, $filename, "duplicate method copies collateral");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
my $tests = 64;
|
||||
my $tests = 82;
|
||||
plan tests => $tests + 1;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -352,42 +352,85 @@ cmp_deeply($rJSON->responseScoresByVariableName, { s1q0 => 100, s1q1 => 200, s1
|
|||
# Turn on the survey Expression Engine
|
||||
WebGUI::Test->originalConfig('enableSurveyExpressionEngine');
|
||||
$session->config->set('enableSurveyExpressionEngine', 1);
|
||||
$rJSON->survey->section([0])->{variable} = 's0'; # our first test jump target
|
||||
$rJSON->survey->section([2])->{variable} = 's2'; # our second test jump target
|
||||
$rJSON->survey->question([1,0])->{variable} = 's1q0'; # a question variable to use in our expressions
|
||||
$rJSON->survey->answer([1,0,0])->{recordedAnswer} = 3; # value recorded in responses hash for multi-choice answer
|
||||
$rJSON->survey->section([0])->{variable} = 's0';
|
||||
$rJSON->survey->question([0,0])->{variable} = 's0q0'; # surveyOrder index = 0
|
||||
$rJSON->survey->question([0,1])->{variable} = 's0q1'; # surveyOrder index = 1
|
||||
$rJSON->survey->question([0,2])->{variable} = 's0q2'; # surveyOrder index = 2
|
||||
$rJSON->survey->section([1])->{variable} = 's1';
|
||||
$rJSON->survey->question([1,0])->{variable} = 's1q0'; # surveyOrder index = 3
|
||||
$rJSON->survey->question([1,1])->{variable} = 's1q1'; # surveyOrder index = 4
|
||||
$rJSON->survey->section([2])->{variable} = 's2'; # empty section appears as surveyOrder index = 5
|
||||
$rJSON->survey->section([3])->{variable} = 's3';
|
||||
$rJSON->survey->question([3,0])->{variable} = 's3q0'; # surveyOrder index = 6
|
||||
$rJSON->survey->question([3,1])->{variable} = 's3q1'; # surveyOrder index = 7
|
||||
$rJSON->survey->question([3,2])->{variable} = 's3q2'; # surveyOrder index = 8
|
||||
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->survey->answer([0,0,0])->{recordedAnswer} = 3; # value recorded in responses hash for multi-choice answer
|
||||
$rJSON->survey->answer([0,0,0])->{value} = 100; # set answer score
|
||||
$rJSON->survey->answer([0,1,0])->{value} = 200; # set answer score
|
||||
|
||||
# Reset responses and record first answer
|
||||
$rJSON->lastResponse(-1);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'My chosen answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
'0-0-0' => 'I chose the first answer to s0q0',
|
||||
'0-1-0' => 'I chose the first answer to s0q1',
|
||||
});
|
||||
is($rJSON->lastResponse, 4, 'lastResponse at 4 before any gotoExpressions processed');
|
||||
|
||||
is($rJSON->nextResponse, 2, 'nextResponse at 2 (s0q1) after first response');
|
||||
|
||||
$rJSON->processGotoExpression('blah-dee-blah-blah {');
|
||||
is($rJSON->lastResponse, 4, '..unchanged after duff expression');
|
||||
is($rJSON->nextResponse, 2, '..unchanged after duff expression');
|
||||
|
||||
$rJSON->processGotoExpression('jump { value(s1q0) == 4} s0');
|
||||
is($rJSON->lastResponse, 4, '..unchanged after false expression');
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 4} s1');
|
||||
is($rJSON->nextResponse, 2, '..unchanged after false expression');
|
||||
|
||||
$rJSON->processGotoExpression('jump { value(s1q0) == 4} s0; jump { value(s1q0) == 5} s0;');
|
||||
is($rJSON->lastResponse, 4, '..similarly for multi-statement false expression');
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 4} s0; jump { value(s1q0) == 5} s1;');
|
||||
is($rJSON->nextResponse, 2, '..similarly for multi-statement false expression');
|
||||
|
||||
$rJSON->processGotoExpression('jump { value(s1q0) == 3} DUFF_TARGET');
|
||||
is($rJSON->lastResponse, 4, '..similarly for expression with invalid target');
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} DUFF_TARGET');
|
||||
is($rJSON->nextResponse, 2, '..similarly for expression with invalid target');
|
||||
|
||||
$rJSON->processGotoExpression('jump { value(s1q0) == 3} s0');
|
||||
is($rJSON->lastResponse, -1, '..but updated to s0 after true expression');
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} s1');
|
||||
is($rJSON->nextResponse, 3, 'jumps to index of first question in section');
|
||||
|
||||
$rJSON->processGotoExpression('jump { value(s1q0) == 4} s0; jump { value(s1q0) == 3} s2');
|
||||
is($rJSON->lastResponse, 4, '..changed again for multi-statement true expression');
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} s2');
|
||||
is($rJSON->nextResponse, 5, '..and updated to s2 with different jump target');
|
||||
|
||||
$rJSON->processGotoExpression('jump { score(s1q0) == 100} s0');
|
||||
is($rJSON->lastResponse, -1, '..and again when score used');
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} s3');
|
||||
is($rJSON->nextResponse, 6, '..and updated to s3 with different jump target');
|
||||
|
||||
$rJSON->processGotoExpression('jump { score("s1") == 300} s2');
|
||||
is($rJSON->lastResponse, 4, '..and again when section score total used');
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} s3q1');
|
||||
is($rJSON->nextResponse, 7, '..we can also jump to a question rather than a section');
|
||||
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} NEXT_SECTION');
|
||||
is($rJSON->nextResponse, 3, '..we can also use the NEXT_SECTION target');
|
||||
|
||||
$rJSON->lastResponse(3); # pretend we just finished s1q0
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} NEXT_SECTION');
|
||||
is($rJSON->nextResponse, 5, '..try that again from a different starting point');
|
||||
|
||||
$rJSON->lastResponse(8); # pretend we just finished s3q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} NEXT_SECTION');
|
||||
is($rJSON->nextResponse, 9, '..NEXT_SECTION on the last section is ok, it just ends the survey');
|
||||
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 3} END_SURVEY');
|
||||
is($rJSON->nextResponse, 9, '..we can also jump to end with END_SURVEY target');
|
||||
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { value(s0q0) == 4} s0; jump { value(s0q0) == 3} s1');
|
||||
is($rJSON->nextResponse, 3, '..first true statement wins');
|
||||
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { score(s0q0) == 100} s1');
|
||||
is($rJSON->nextResponse, 3, '..and again when score used');
|
||||
|
||||
$rJSON->nextResponse(2); # pretend we just finished s0q2
|
||||
$rJSON->processGotoExpression('jump { score("s0") == 300} s1');
|
||||
is($rJSON->nextResponse, 3, '..and again when section score total used');
|
||||
|
||||
$rJSON->responses({});
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
|
|
@ -475,6 +518,7 @@ cmp_deeply(
|
|||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0verbatim' => 'First answer verbatim', # ignored
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
}),
|
||||
[ 1, 'question 1-0 terminal' ],
|
||||
|
|
@ -494,6 +538,7 @@ cmp_deeply(
|
|||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
'time' => num(time(), 3),
|
||||
value => 1, # 'recordedAnswer' value used because question is multi-choice
|
||||
verbatim => undef,
|
||||
},
|
||||
'1-1' => {
|
||||
comment => undef,
|
||||
|
|
@ -502,11 +547,42 @@ cmp_deeply(
|
|||
'recordResponses: recorded responses correctly, two questions, one answer, comments, values and time'
|
||||
);
|
||||
|
||||
# Check that raw input is recorded for verbatim mc answers
|
||||
$rJSON->survey->answer([1,0,0])->{verbatim} = 1;
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->responses({});
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0verbatim' => 'First answer verbatim',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
});
|
||||
cmp_deeply(
|
||||
$rJSON->responses,
|
||||
{
|
||||
'1-0' => {
|
||||
comment => 'Section 1, question 0 comment',
|
||||
},
|
||||
'1-0-0' => {
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
'time' => num(time(), 3),
|
||||
value => 1, # 'recordedAnswer' value used because question is multi-choice
|
||||
verbatim => 'First answer verbatim',
|
||||
},
|
||||
'1-1' => {
|
||||
comment => undef,
|
||||
}
|
||||
},
|
||||
'recordResponses: verbatim answer recorded responses correctly'
|
||||
);
|
||||
$rJSON->survey->answer([1,0,0])->{verbatim} = 0; # revert change
|
||||
|
||||
# Repeat with non multi-choice question, to check that submitted answer value is used
|
||||
# instead of recordedValue
|
||||
$rJSON->survey->question([1,0])->{questionType} = 'Text';
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->responses({});
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
|
|
@ -523,6 +599,7 @@ cmp_deeply(
|
|||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
'time' => num(time(), 3),
|
||||
value => 'First answer', # submitted answer value used this time because non-mc
|
||||
verbatim => undef,
|
||||
},
|
||||
'1-1' => {
|
||||
comment => undef,
|
||||
|
|
@ -561,9 +638,108 @@ cmp_deeply(
|
|||
'recordResponses: if the answer is all whitespace, it is skipped over'
|
||||
);
|
||||
is($rJSON->questionsAnswered, 0, 'question was all whitespace, not answered');
|
||||
#delete $rJSON->{_session};
|
||||
#delete $rJSON->survey->{_session};
|
||||
#diag(Dumper($rJSON));
|
||||
|
||||
####################################################
|
||||
#
|
||||
# pop
|
||||
#
|
||||
####################################################
|
||||
$rJSON->responses({});
|
||||
$rJSON->lastResponse(2);
|
||||
is($rJSON->pop, undef, 'pop with no responses returns undef');
|
||||
cmp_deeply($rJSON->responses, {}, 'initially no responses');
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
'1-1comment' => 'Section 1, question 1 comment',
|
||||
'1-1-0' => 'Second answer',
|
||||
'1-1-0comment' => 'Section 1, question 1, answer 0 comment',
|
||||
|
||||
});
|
||||
my $popped = $rJSON->pop;
|
||||
cmp_deeply($popped, {
|
||||
# the first q answer
|
||||
'1-0-0' => {
|
||||
value => 1,
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
time => num(time(), 3),
|
||||
verbatim => undef,
|
||||
},
|
||||
# the second q answer
|
||||
'1-1-0' => {
|
||||
value => 0,
|
||||
comment => 'Section 1, question 1, answer 0 comment',
|
||||
time => num(time(), 3),
|
||||
verbatim => undef,
|
||||
},
|
||||
# the first question comment
|
||||
'1-0' => {
|
||||
comment => 'Section 1, question 0 comment',
|
||||
},
|
||||
# the second question comment
|
||||
'1-1' => {
|
||||
comment => 'Section 1, question 1 comment',
|
||||
}
|
||||
}, 'pop removes only existing response');
|
||||
cmp_deeply($rJSON->responses, {}, 'and now back to no responses');
|
||||
is($rJSON->pop, undef, 'additional pop has no effect');
|
||||
|
||||
$rJSON->responses({});
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
'1-1comment' => 'Section 1, question 1 comment',
|
||||
'1-1-0' => 'Second answer',
|
||||
'1-1-0comment' => 'Section 1, question 1, answer 0 comment',
|
||||
});
|
||||
|
||||
# fake time so that pop thinks first response happened earlier
|
||||
$rJSON->responses->{'1-0-0'}->{time} -= 1;
|
||||
cmp_deeply($rJSON->pop, {
|
||||
# the second q answer
|
||||
'1-1-0' => {
|
||||
value => 0,
|
||||
comment => 'Section 1, question 1, answer 0 comment',
|
||||
time => num(time(), 3),
|
||||
verbatim => undef,
|
||||
},
|
||||
# the second question comment
|
||||
'1-1' => {
|
||||
comment => 'Section 1, question 1 comment',
|
||||
}
|
||||
}, 'pop now only removes the most recent response');
|
||||
cmp_deeply($rJSON->responses, {
|
||||
# the first q answer
|
||||
'1-0-0' => {
|
||||
value => 1,
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
time => num(time(), 3),
|
||||
verbatim => undef,
|
||||
},
|
||||
# the first question comment
|
||||
'1-0' => {
|
||||
comment => 'Section 1, question 0 comment',
|
||||
},
|
||||
}, 'and first response left in tact');
|
||||
cmp_deeply($rJSON->pop, {
|
||||
# the first q answer
|
||||
'1-0-0' => {
|
||||
value => 1,
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
time => num(time(), 3),
|
||||
verbatim => undef,
|
||||
},
|
||||
# the first question comment
|
||||
'1-0' => {
|
||||
comment => 'Section 1, question 0 comment',
|
||||
},
|
||||
}, 'second pop removes first response');
|
||||
cmp_deeply($rJSON->responses, {}, '..and now responses hash empty again');
|
||||
|
||||
is($rJSON->pop, undef, 'additional pop has no effect');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
my $tests = 139;
|
||||
my $tests = 137;
|
||||
plan tests => $tests + 1 + 3;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -1384,15 +1384,15 @@ cmp_deeply(
|
|||
|
||||
####################################################
|
||||
#
|
||||
# addAnswersToQuestion
|
||||
# addAnswersToQuestion, getMultiChoiceBundle
|
||||
#
|
||||
####################################################
|
||||
|
||||
#We'll work exclusively with Question 3-0
|
||||
|
||||
my $answerBundle = $surveyJSON->getMultiChoiceBundle('Yes/No');
|
||||
$surveyJSON->addAnswersToQuestion( [3,0],
|
||||
[ qw[ one two three ] ],
|
||||
{}
|
||||
$answerBundle,
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
|
|
@ -1400,85 +1400,20 @@ cmp_deeply(
|
|||
superhashof({
|
||||
answers => [
|
||||
superhashof({
|
||||
text => 'one',
|
||||
text => 'Yes',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
value => 1,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'two',
|
||||
text => 'No',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 2,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'three',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 3,
|
||||
recordedAnswer => 0,
|
||||
value => 1,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
'addAnswersToQuestion: setup three answers, no verbatims'
|
||||
);
|
||||
|
||||
$surveyJSON->question([3,0])->{answers} = [];
|
||||
|
||||
$surveyJSON->addAnswersToQuestion( [3,0],
|
||||
[ qw[ one two three ] ],
|
||||
{ 1 => 1, 2 => 1 }
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0]),
|
||||
superhashof({
|
||||
answers => [
|
||||
superhashof({
|
||||
text => 'one',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'two',
|
||||
verbatim => 1,
|
||||
recordedAnswer => 2,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'three',
|
||||
verbatim => 1,
|
||||
recordedAnswer => 3,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
'addAnswersToQuestion: setup verbatims on two answers'
|
||||
);
|
||||
|
||||
$surveyJSON->question([3,0])->{answers} = [];
|
||||
|
||||
$surveyJSON->addAnswersToQuestion( [3,0],
|
||||
[ qw[ one two three ] ],
|
||||
{ 1 => 0 }
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0]),
|
||||
superhashof({
|
||||
answers => [
|
||||
superhashof({
|
||||
text => 'one',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'two',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 2,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'three',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 3,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
'addAnswersToQuestion: verbatims have to exist, and be true'
|
||||
'addAnswersToQuestion: Yes/No bundle created'
|
||||
);
|
||||
|
||||
####################################################
|
||||
|
|
@ -1507,12 +1442,12 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Male',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
superhashof({
|
||||
text => 'Female',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 2,
|
||||
recordedAnswer => 1,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Gender type'
|
||||
|
|
@ -1530,7 +1465,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'No',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 2,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Yes/No type'
|
||||
|
|
@ -1548,10 +1483,10 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'False',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 2,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Yes/No type'
|
||||
'updateQuestionAnswers: True/False type'
|
||||
);
|
||||
|
||||
$surveyJSON->updateQuestionAnswers([3,0], 'Agree/Disagree');
|
||||
|
|
@ -1561,7 +1496,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Strongly disagree',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1571,7 +1506,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Strongly agree',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 7,
|
||||
recordedAnswer => 6,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Agree/Disagree type'
|
||||
|
|
@ -1584,7 +1519,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Strongly oppose',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1594,7 +1529,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Strongly support',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 7,
|
||||
recordedAnswer => 6,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Agree/Disagree type'
|
||||
|
|
@ -1607,7 +1542,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all important',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1617,7 +1552,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely important',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Importance type'
|
||||
|
|
@ -1630,7 +1565,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all likely',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1640,7 +1575,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely likely',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Likelihood type'
|
||||
|
|
@ -1653,7 +1588,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all certain',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1663,7 +1598,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely certain',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Certainty type'
|
||||
|
|
@ -1676,7 +1611,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all satisfied',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1686,7 +1621,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely satisfied',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Satisfaction type'
|
||||
|
|
@ -1699,7 +1634,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all confident',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1709,7 +1644,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely confident',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Confidence type'
|
||||
|
|
@ -1722,7 +1657,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all effective',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1732,7 +1667,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely effective',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Effectiveness type'
|
||||
|
|
@ -1745,7 +1680,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all concerned',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1755,7 +1690,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely concerned',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Concern type'
|
||||
|
|
@ -1768,7 +1703,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'No risk',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1778,7 +1713,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extreme risk',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Risk type'
|
||||
|
|
@ -1791,7 +1726,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'No threat',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1801,7 +1736,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extreme threat',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Threat type'
|
||||
|
|
@ -1814,7 +1749,7 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Not at all secure',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 1,
|
||||
recordedAnswer => 0,
|
||||
}),
|
||||
( superhashof({
|
||||
text => '',
|
||||
|
|
@ -1824,14 +1759,14 @@ cmp_deeply(
|
|||
superhashof({
|
||||
text => 'Extremely secure',
|
||||
verbatim => 0,
|
||||
recordedAnswer => 11,
|
||||
recordedAnswer => 10,
|
||||
}),
|
||||
],
|
||||
'updateQuestionAnswers: Security type'
|
||||
);
|
||||
|
||||
$surveyJSON->updateQuestionAnswers([3,0], 'Ideology');
|
||||
my $index = 1;
|
||||
my $index = 0;
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0])->{answers},
|
||||
[
|
||||
|
|
@ -1854,14 +1789,14 @@ cmp_deeply(
|
|||
);
|
||||
|
||||
$surveyJSON->updateQuestionAnswers([3,0], 'Race');
|
||||
$index = 1;
|
||||
$index = 0;
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0])->{answers},
|
||||
[
|
||||
map {
|
||||
superhashof({
|
||||
text => $_,
|
||||
verbatim => $index == 6 ? 1 : 0,
|
||||
verbatim => $index == 5 ? 1 : 0,
|
||||
recordedAnswer => $index++,
|
||||
})
|
||||
} 'American Indian', 'Asian', 'Black', 'Hispanic', 'White non-Hispanic', 'Something else (verbatim)',
|
||||
|
|
@ -1870,14 +1805,14 @@ cmp_deeply(
|
|||
);
|
||||
|
||||
$surveyJSON->updateQuestionAnswers([3,0], 'Party');
|
||||
$index = 1;
|
||||
$index = 0;
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0])->{answers},
|
||||
[
|
||||
map {
|
||||
superhashof({
|
||||
text => $_,
|
||||
verbatim => $index == 4 ? 1 : 0,
|
||||
verbatim => $index == 3 ? 1 : 0,
|
||||
recordedAnswer => $index++,
|
||||
})
|
||||
} 'Democratic party', 'Republican party (or GOP)', 'Independent party', 'Other party (verbatim)',
|
||||
|
|
@ -1886,14 +1821,14 @@ cmp_deeply(
|
|||
);
|
||||
|
||||
$surveyJSON->updateQuestionAnswers([3,0], 'Education');
|
||||
$index = 1;
|
||||
$index = 0;
|
||||
cmp_deeply(
|
||||
$surveyJSON->question([3,0])->{answers},
|
||||
[
|
||||
map {
|
||||
superhashof({
|
||||
text => $_,
|
||||
verbatim => $index == 8 ? 1 : 0,
|
||||
verbatim => $index == 7 ? 1 : 0,
|
||||
recordedAnswer => $index++,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue