@@ -2,8 +2,9 @@ module TestExt
2
2
3
3
using Test
4
4
using ComputerAdaptiveTesting: Stateful
5
+ using FittedItemBanks: AbstractItemBank, ItemResponse, resp
5
6
6
- export test_stateful_cat_1d_dich_ib
7
+ export test_stateful_cat_1d_dich_ib, test_stateful_cat_item_bank_1d_dich_ib
7
8
8
9
function test_stateful_cat_1d_dich_ib (
9
10
cat:: Stateful.StatefulCat ,
@@ -66,9 +67,8 @@ function test_stateful_cat_1d_dich_ib(
66
67
end
67
68
end
68
69
69
- Stateful. reset! (cat)
70
-
71
70
@testset " basic get_ability tests" begin
71
+ Stateful. reset! (cat)
72
72
Stateful. add_response! (cat, 1 , false )
73
73
Stateful. add_response! (cat, 2 , true )
74
74
ability = Stateful. get_ability (cat)
@@ -79,6 +79,7 @@ function test_stateful_cat_1d_dich_ib(
79
79
80
80
if supports_rollback
81
81
@testset " rollback ability tests" begin
82
+ Stateful. reset! (cat)
82
83
Stateful. add_response! (cat, 1 , false )
83
84
ability1 = Stateful. get_ability (cat)
84
85
Stateful. add_response! (cat, 2 , true )
@@ -91,4 +92,22 @@ function test_stateful_cat_1d_dich_ib(
91
92
end
92
93
end
93
94
95
+ function test_stateful_cat_item_bank_1d_dich_ib (
96
+ cat:: Stateful.StatefulCat ,
97
+ item_bank:: AbstractItemBank ,
98
+ points= [- .78 , 0.0 , .78 ],
99
+ margin= 0.05 ,
100
+ )
101
+ if length (item_bank) != Stateful. item_bank_size (cat)
102
+ error (" Item bank length does not match the cat's item bank size." )
103
+ end
104
+ for i in 1 : length (item_bank)
105
+ for point in points
106
+ cat_prob = Stateful. item_response_function (cat, i, true , point)
107
+ ib_prob = resp (ItemResponse (item_bank, i), true , point)
108
+ @test cat_prob ≈ ib_prob rtol= margin
109
+ end
110
+ end
111
+ end
112
+
94
113
end
0 commit comments