// Copyright 2017-2018 DERO Project. All rights reserved. // Use of this source code in any form is governed by RESEARCH license. // license can be found in the LICENSE file. // GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8 // // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package mnemonics import "testing" // we are covering atleast one test case each for all supported languages func Test_Mnemonics(t *testing.T) { tests := []struct { name string seed string spend_key_secret string }{ { name: "English", seed: "sequence atlas unveil summon pebbles tuesday beer rudely snake rockets different fuselage woven tagged bested dented vegan hover rapid fawns obvious muppet randomly seasons randomly", spend_key_secret: "b0ef6bd527b9b23b9ceef70dc8b4cd1ee83ca14541964e764ad23f5151204f0f", }, { name: "Deutsch", seed: "Dekade Spagat Bereich Radclub Yeti Dialekt Unimog Nomade Anlage Hirte Besitz Märzluft Krabbe Nabel Halsader Chefarzt Hering tauchen Neuerung Reifen Umgang Hürde Alchimie Amnesie Reifen", spend_key_secret: "a00b3c431e0037426f12b255aaca918863c8bbc690ff3765564bcc1de7fbb303", }, { name: "Español", seed: "perfil lujo faja puma favor pedir detalle doble carbón neón paella cuarto ánimo cuento conga correr dental moneda león donar entero logro realidad acceso doble", spend_key_secret: "4f1101c4cc6adc6e6a63acde4e71fd76dc4471fa54769866d5e80a0a3d53d00c", }, { name: "Français", seed: "lisser onctueux pierre trace flair riche machine ordre soir nougat talon balle biceps crier trame tenu gorge cuisine taverne presque laque argent roche secte ordre", spend_key_secret: "340ed50ef73ba172e2fef23dc9f60e314f609bb7692d22d59f3938c391570b0a", }, { name: "Italiano", seed: "sospiro uomo sommario orecchio muscolo testa avido sponda mutande levare lamento frumento volpe zainetto ammirare stufa convegno patente salto venire pianeta marinaio minuto moneta moneta", spend_key_secret: "21cb90e631866952954cdcba042a3ae90407c40c052cc067226df0b454933502", }, { name: "Nederlands", seed: "veto hobo tolvrij cricket somber omaans lourdes kokhals ionisch lipman freon neptunus zimmerman rijbaan wisgerhof oudachtig nerd walraven ruis gevecht foolen onheilig rugnummer russchen cricket", spend_key_secret: "921cbd7640df5fd12effb8f4269c5a47bac0ef3f75a0c25aa9f174f589801102", }, { name: "Português", seed: "guloso caatinga enunciar newtoniano aprumo ilogismo vazio gibi imovel mixuruca bauxita paludismo unanimidade zumbi vozes roer anzol leonardo roer ucraniano elmo paete susto taco imovel", spend_key_secret: "92da2722c7138e65559973131fd2c69b4a0ae4faf0e12b7abe096d5870d6a700", }, { name: "русский язык", seed: "шорох рента увлекать пешеход гонка сеять пчела ваза апатия пишущий готовый вибрация юбка здоровье машина штука охрана доза рынок клоун рецепт отпуск шестерка эволюция вибрация", spend_key_secret: "3d0fb729be695b865c073eed68ee91f06d429a27f8eaaaa6a99f954edbef8406", }, { name: "日本語", seed: "かわく ねまき けもの せいげん ためる にんめい てあみ にりんしゃ さわやか えらい うちき けいかく あたる せっきゃく ずっしり かいよう おおや てらす くれる ばかり なこうど たいうん そまつ たいえき せいげん", spend_key_secret: "e12da07065554a32ac798396f74dbb35557164f9f39291a3f95705e62e0d7703", }, { name: "简体中文 (中国)", seed: "启 写 输 苯 加 担 乳 代 集 预 懂 均 倒 革 熟 载 隆 台 幸 谋 轮 抚 扩 急 输", spend_key_secret: "3bfd99190f28bd7830b3631cfa514176fc24e88281fe056ce447a5a7fcdc9a02", }, { name: "Esperanto", seed: "amrakonto facila vibri obtuza gondolo membro alkoholo oferti ciumi reinspekti azteka kupro gombo keglo dugongo diino hemisfero sume servilo bambuo sekretario alta diurno duloka hemisfero", spend_key_secret: "61abd2a5625a95371882117d8652e0735779b7b535008c73d65735b9477b1105", }, } for _, test := range tests { language, key, err := Words_To_Key(test.seed) if err != nil || language != test.name || test.spend_key_secret != key.Text(16) { t.Errorf("%s Mnemonics testing failed err %s expected %s actual %s", test.name, err, test.spend_key_secret, key.Text(16)) } generated_seed := Key_To_Words(key, test.name) if generated_seed != test.seed { t.Errorf("SEED generation %s failed expected '%s' found '%s'", test.name, test.seed, generated_seed) } } // test checksum failure test := tests[0] seed := "sequence atlas unveil summon pebbles tuesday beer rudely snake rockets different fuselage woven tagged bested dented vegan hover rapid fawns obvious muppet randomly seasons seasons" language, _, err := Words_To_Key(seed) if err == nil || language != test.name { t.Errorf("%s Mnemonics testing failed err %s", test.name, err) } }