test: [Mi麻雀] 役満(天和、地和を除く)のテスト (#13263)

* add daisangen test

* add suanko test

* add suanko-tanki test

* add tsuiso test

* fix typo

* add test-shosushi

* add test-daisushi

* add ryuiso-test

* add chinroto-test

* add sukantsu-test

* add kokushi-13-test
This commit is contained in:
im_tan 2024-02-12 18:38:55 +09:00 committed by GitHub
parent b04a0c99a4
commit af9ebf7034
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,11 +22,12 @@ describe('Yaku', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e'] ,
handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] ,
huros: [],
tumoTiles: 'm1',
tumoTiles: 'm9',
}), ['kokushi']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
@ -37,6 +38,294 @@ describe('Yaku', () => {
});
});
describe('kokushi-13', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm1'] ,
huros: [],
tumoTiles: 'm1',
}), ['kokushi-13']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] ,
huros: [],
tumoTiles: 'm1',
}).includes('kokushi-13'), false);
});
});
describe('suanko', () => {
it('valid',() => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [],
tsumoTile: 'chun',
}), ['suanko']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [{type: 'ankan', :tile: 'm1'}],
tsumoTile: 'chun',
}), ['suanko']);
});
it('invalid',() => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [{type: 'pom', tile: 'm1'}],
ronTile: 'e',
}).includes('suanko'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [],
ronTile: 'e',
}).includes('suanko'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [],
ronTile: 'e',
}).includes('suanko'), false);
});
});
describe('suanko-tanki', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'],
huros: [],
tsumoTile: 'e',
}), ['suanko-tanki']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'],
huros: [{type: 'ankan', tile: 'm1'}],
tsumoTile: 'e',
}), ['suanko-tanki']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [],
tsumoTile: 'chun',
}).includes('suanko-tanki'), false);
});
})
describe('daisangen', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['haku', 'haku', 'haku', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'p2', 'p2', 'p2', 's2', 's2'],
huros: [],
tsumoTile: 's2',
}), ['daisangen']);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'p2', 'p2', 'p2', 's2', 's2'],
huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 's2',
}), ['daisangen']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['haku', 'haku', 'haku', 'chun', 'chun', 'hatsu', 'hatsu', 'hatsu', 'm1', 'm1', 'm1', 'm2', 'm2', 'm2'] ,
huros: [],
tumoTiles: 'm2',
}).includes('daisangen'), false);
});
});
describe('tsuiso', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['haku', 'haku', 'haku', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [],
tsumoTile: 's',
}), ['tsuiso']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 's',
}), ['tsuiso']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [],
tsumoTile: 's',
}).includes('tsuiso'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 's',
}).includes('tuiso'), false);
});
})
describe('shosushi', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [],
tsumoTile: 's',
}), ['shosushi']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'e'}],
tsumoTile: 's',
}), ['shosushi']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [],
tsumoTile: 's',
}).includes('shosushi'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 's',
}).includes('shosushi'), false);
});
})
describe('daisushi', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's', 's'],
huros: [],
tsumoTile: 's',
}), ['daisushi']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's', 's'],
huros: [{type: 'pon', tile: 'e'}],
tsumoTile: 'e',
}), ['daisushi']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [],
tsumoTile: 's',
}).includes('daisushi'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'e',
}).includes('daisushi'), false);
});
})
describe('ryuiso', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's4', 's6', 's6', 's6', 's8', 's8', 's8', 'hatsu', 'hatsu'],
huros: [],
tsumoTile: 'hatsu',
}), ['ryuiso']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'],
huros: [{type: 'pon', tile: 'hatsu'}],
tsumoTile: 's8',
}), ['ryuiso']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'],
huros: [],
tsumoTile: 's',
}).includes('ryuiso'), false);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'],
huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 's',
}).includes('ryuiso'), false);
});
})
describe('chinroto', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m1','m1','m1''m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'],
huros: [],
tsumoTile: 'p1',
}), ['chinroto']);
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'p1',
}), ['chinroto']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'],
huros: [],
tsumoTile: 's',
}).includes('chinroto'), false);
});
})
describe('sukantsu', () => {
it('valid', () =>{
assert.deepStrictEqual(calcYakus({
house: '',
handTiles: ['p1', 'p1'],
huros: [{type: 'ankan', tile: 'm1'}, {type: 'ankan', tile: 'm2'}, {type: 'minkan', tile: 'm3'}, {type: 'minkan', tile: 'chun'}],
tsumoTile: 'p1',
}), ['sukantsu']);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm3', 'm3', 'm4', 'm6', 'm7', 'm8', 'm9', 'm9', 'm9', 'm2'],
huros: [],
tsumoTile: 'm2',
}).includes('sukantsu'), false);
});
})
describe('churen', () => {
it('valid', () => {