Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
3cb08a04
Commit
3cb08a04
authored
10 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-716: fix unit test of difficulty
parent
849dd82a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/olat/ims/qti/statistics/manager/QTIStatisticsManagerLargeTest.java
+7
-2
7 additions, 2 deletions
...qti/statistics/manager/QTIStatisticsManagerLargeTest.java
with
7 additions
and
2 deletions
src/test/java/org/olat/ims/qti/statistics/manager/QTIStatisticsManagerLargeTest.java
+
7
−
2
View file @
3cb08a04
...
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull;
...
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -93,6 +94,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
...
@@ -93,6 +94,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
private
static
float
durationQ3
=
0.0f
;
private
static
float
durationQ3
=
0.0f
;
private
static
float
scoreQ1
=
0.0f
;
private
static
float
scoreQ1
=
0.0f
;
private
static
float
scoreQ2
=
0.0f
;
private
static
float
scoreQ2
=
0.0f
;
private
static
int
rightAnswersQ2
=
0
;
private
static
int
wrongAnswersQ2
=
0
;
private
static
int
wrongAnswersQ2
=
0
;
private
static
List
<
String
>
fibAnswers
=
new
ArrayList
<
String
>();
private
static
List
<
String
>
fibAnswers
=
new
ArrayList
<
String
>();
...
@@ -140,7 +142,9 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
...
@@ -140,7 +142,9 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
test
.
setDuration
(
tempTestDuration
);
test
.
setDuration
(
tempTestDuration
);
test
.
setIdentity
(
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"test"
+
i
));
test
.
setIdentity
(
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"test"
+
i
));
test
.
setAssessmentID
(
111L
);
test
.
setAssessmentID
(
111L
);
test
.
setLastModified
(
new
Date
(
200
,
8
,
23
,
(
int
)
(
Math
.
random
()
*
1000
%
60
),
(
int
)
(
Math
.
random
()
*
1000
%
60
),
(
int
)
(
Math
.
random
()
*
1000
%
60
)));
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
2013
,
8
,
23
,
(
int
)
(
Math
.
random
()
*
1000
%
60
),
(
int
)
(
Math
.
random
()
*
1000
%
60
),
(
int
)
(
Math
.
random
()
*
1000
%
60
));
test
.
setLastModified
(
cal
.
getTime
());
dbInstance
.
saveObject
(
test
);
dbInstance
.
saveObject
(
test
);
// insert values into result
// insert values into result
for
(
int
j
=
0
;
j
<
numberOfQuestions
;
j
++)
{
for
(
int
j
=
0
;
j
<
numberOfQuestions
;
j
++)
{
...
@@ -178,6 +182,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
...
@@ -178,6 +182,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
if
(
score
<
3.0f
)
{
if
(
score
<
3.0f
)
{
wrongAnswersQ2
++;
wrongAnswersQ2
++;
}
else
{
}
else
{
rightAnswersQ2
++;
maxScoreQ2
++;
maxScoreQ2
++;
}
}
}
else
if
(
j
==
2
)
{
}
else
if
(
j
==
2
)
{
...
@@ -290,7 +295,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
...
@@ -290,7 +295,7 @@ public class QTIStatisticsManagerLargeTest extends OlatTestCase {
QTIStatisticSearchParams
searchParams
=
new
QTIStatisticSearchParams
(
olatResource
,
olatResourceDetail
);
QTIStatisticSearchParams
searchParams
=
new
QTIStatisticSearchParams
(
olatResource
,
olatResourceDetail
);
StatisticsItem
stats
=
qtim
.
getItemStatistics
(
itemObject
.
getItemIdent
(),
maxValue
,
searchParams
);
StatisticsItem
stats
=
qtim
.
getItemStatistics
(
itemObject
.
getItemIdent
(),
maxValue
,
searchParams
);
double
difficulty
=
scoreQ2
/
maxValue
;
double
difficulty
=
rightAnswersQ2
/
numberOfParticipants
;
Assert
.
assertEquals
(
difficulty
,
stats
.
getDifficulty
(),
0.1
);
Assert
.
assertEquals
(
difficulty
,
stats
.
getDifficulty
(),
0.1
);
Assert
.
assertEquals
(
scoreQ2
,
stats
.
getAverageScore
(),
0.1
);
Assert
.
assertEquals
(
scoreQ2
,
stats
.
getAverageScore
(),
0.1
);
Assert
.
assertEquals
(
wrongAnswersQ2
,
stats
.
getNumOfIncorrectAnswers
());
Assert
.
assertEquals
(
wrongAnswersQ2
,
stats
.
getNumOfIncorrectAnswers
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment