Skip to content

Commit e1a8e56

Browse files
Add ElectrumMnemonic.IsOld tests
1 parent c296d3b commit e1a8e56

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Src/Tests/Bitcoin/ImprovementProposals/ElectrumMnemonicTests.cs

+27
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,32 @@ public void GetAllWordsTest()
208208
Assert.Equal(2048, actual.Length);
209209
Assert.Equal("abandon", actual[0]);
210210
}
211+
212+
// https://github.com/spesmilo/electrum/blob/63143307f1ed588f9ce0bca4adff71f6baca4277/electrum/tests/test_mnemonic.py#L153-L173
213+
[Theory]
214+
[InlineData("cell dumb heartbeat north boom tease ship baby bright kingdom rare squeeze", true)]
215+
[InlineData("cell dumb heartbeat north boom tease ", true)]
216+
[InlineData("cell dumb heartbeat north boom tease ship baby bright kingdom rare badword", false)]
217+
[InlineData("cElL DuMb hEaRtBeAt nOrTh bOoM TeAsE ShIp bAbY BrIgHt kInGdOm rArE SqUeEzE", true)]
218+
[InlineData(" cElL DuMb hEaRtBeAt nOrTh bOoM TeAsE ShIp bAbY BrIgHt kInGdOm rArE SqUeEzE ", true)]
219+
[InlineData("hurry idiot prefer sunset mention mist jaw inhale impossible kingdom rare squeeze", true)]
220+
[InlineData("cram swing cover prefer miss modify ritual silly deliver chunk behind inform able", false)]
221+
[InlineData("cram swing cover prefer miss modify ritual silly deliver chunk behind inform", false)]
222+
[InlineData("ostrich security deer aunt climb inner alpha arm mutual marble solid task", false)]
223+
[InlineData("OSTRICH SECURITY DEER AUNT CLIMB INNER ALPHA ARM MUTUAL MARBLE SOLID TASK", false)]
224+
[InlineData(" oStRiCh sEcUrItY DeEr aUnT ClImB InNeR AlPhA ArM MuTuAl mArBlE SoLiD TaSk ", false)]
225+
[InlineData("x8", false)]
226+
[InlineData("science dawn member doll dutch real can brick knife deny drive list", false)]
227+
[InlineData("science dawn member doll dutch real ca brick knife deny drive list", false)]
228+
[InlineData(" sCience dawn member doll Dutch rEAl can brick knife deny drive lisT", false)]
229+
[InlineData("frost pig brisk excite novel report camera enlist axis nation novel desert", false)]
230+
[InlineData(" fRoSt pig brisk excIte novel rePort CamEra enlist axis nation nOVeL dEsert ", false)]
231+
[InlineData("9dk", false)]
232+
[InlineData("hardly point goal hallway patience key stone difference ready caught listen fact", true)]
233+
public void IsOldTest(string m, bool expected)
234+
{
235+
bool actual = ElectrumMnemonic.IsOld(m);
236+
Assert.Equal(expected, actual);
237+
}
211238
}
212239
}

0 commit comments

Comments
 (0)