Skip to content

Commit

Permalink
Add a test for get_sequence_move().
Browse files Browse the repository at this point in the history
Disable/hide the animated/graphic solution display if the game-variant rules do not match 8cols+4reserves freecell
  • Loading branch information
shlomif committed Apr 7, 2024
1 parent 35811a1 commit 3ea5b26
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
43 changes: 43 additions & 0 deletions fc-solve/site/wml/src/ts/tests/fcs-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,49 @@ function my_func(qunit: QUnit, _my_mod, my_callback: () => void) {
},
);

qunit.test("FC_Solve user_get_sequence_move pristine", (assert) => {
assert.expect(1);

const instance: w.FC_Solve = new FC_Solve({
module_wrapper,
cmd_line_preset: "default",
set_status_callback: () => {
return;
},
});

// TEST
assert.equal(
instance.get_sequence_move(),
0,
"get_sequence_move() returns the default.",
);
});

qunit.test(
"FC_Solve user_get_sequence_move after CLI flag",
(assert) => {
assert.expect(1);

const instance: w.FC_Solve = new FC_Solve({
module_wrapper,
cmd_line_preset: "default",
dir_base: "fcs5",
set_status_callback: () => {
return;
},
string_params: "--sequence-move unlimited",
});

// TEST
assert.equal(
instance.get_sequence_move(),
1,
"get_sequence_move() returns the modified value after command line.",
);
},
);

qunit.test("FC_Solve deal_ms_fc_board", (assert) => {
assert.expect(2);

Expand Down
5 changes: 5 additions & 0 deletions fc-solve/site/wml/src/ts/web-fc-solve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,11 @@ export class FC_Solve {

return that.module_wrapper.user_get_num_stacks(that.obj);
}
public get_sequence_move(): number {
const that = this;

return that.module_wrapper.user_get_sequence_move(that.obj);
}
private _calc_states_and_moves_seq() {
const that = this;

Expand Down

0 comments on commit 3ea5b26

Please sign in to comment.