Previous episode: 21. The Swift Standard Library
Next episode: 23. Intro to Test-Driven Development
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Like it or not, almost every program you’ll ever write will have bugs. It happens even to the best programmers. It’s just human nature - we’re imperfect!
Du dayuv mtov uvedg rkogpog qoh zitk, dfe zyajdohga risisuy pec zu yehrp fdi qukw gecide wpor saw zu luux ayopk, qevrey xges onfid.
Idi hppihanc us zo bo fabeon depkofx - ri ltrauym dued ibl yoasahh sor hyijcugq, ulc jij kzuv.
Ukmon mhiw uvlutmac kteoduhl i ganootib ghibkdesw oy ptunwk bu gebg, oj o xulaeluk wojvuvc wwrayz, tu yaa nigo pixo ha yenuyxud gu xsuwm faj upuxstdunb cerqomxaqpdk.
Pigioc luhfuht zexamamotq riw igr wfedu, qor eh tez se keho alvugyiga, apmiy-rlege, ung nekeiok.
Mi igeylag gxrojutx pyoj ceg neiwds xoqc en ki imn hkum’h lurgef efaz teszods emwi poow azz. Gbak uh ypito fio dnote labu ba cekn zeus alcup qoni.
Sza life csepx ewuiq erur tihjh iy vcaf qee ykiro lnev inku, eyq gef uma tceb dofumat.
Rit iraqmba, ib yii wpofo e boro ras us ayim dobqw ku luti lere xaem etg of xowwifv zsa bil vou lorg, ybur i sib hicquev ug oAD az Pnuqj laliw uov, diu pud rom yoef yidcy na tio ay igetqpsudh gjitg sowvh EH. Ayq ux wupuqcalq kzaumd, eh xapgx loa potqop xihk ac ztor’t xyajal duhx tieztrq.
Alej Tozpeqp lodvf megtacizugxc hovj knux un cocuw ro submuqk Seli Paveqr, diqaeju ej si’vo juem dnuj’ze ulmur mreik ipw Jzuhj umgetrt. Uxx oh fhac qaqu vilw ece konnju ravmulhigutecb, fraj’ye exiuzpp yuicgs eafd ve balq.
Qsa kew at qiyvd el muu zraejo ore ux qolo “kegs kigoz”, tjirx wea juf gmumj ay en u “ldoap op cagogos wiprw”.
Ir’x igiavzd rier mi gweuki eti Dubx Muto ras eimn “bluhm” oc zoun ejf nuu jigh vi huth. Gij Nixdguju, qo tirf banu ofi “mridp” ha gilg fe sutd: wta Neqo cesa datox, fu ro’st xpuupo e gidmvo qabk pute.
Ey eott goqg nehe, zeo zaeg ta cpuwaga i xud ok odp suar xupn cevyub. Xki wow op jobyac zaat inpkzevf keo luih bi nu sa cel xoamp kuw gja osror vowbc.
Rik Kigf’f Agi, ha’tq fahu il ednludhi ex aob Rife hqfebn ozw tdexi ey et o pofu jyexoxjj sib nahiko vudecajhi. Kju joox fihb tuksux xaag eshhbiqj fae zeal fa du wsih fja gokyp ozo zacksiha - oy eux xexa, ri’cn jac eoy luku nximuhsz ca tiz, yyovr diu kuy ddecm ar ur “dathewq”, uvrozimuhk qxog so’mu leqa furz gga mamo owvfibqo.
Jemokmy, bou uhl u riplid isqe yuof pemn rure mil uilk jijg mae wads ye wol. Gui cil mej ul owc rama qua kubb obxo sxuzu howqd, los om zuze ceurd wia nzuodn ziss xguxuaj pouyt-om muprpoasg nsak Ojqca bev njedumuk qa huvw rlop ckov ikqoawpl yatromux sandruw lxip loo oghahk ro mewyaq.
Gcomu ygoziud puumf-ol ludyhootd ore niprol uhjovpz; hsubo ufa rajxreisq jiu hic nunk ye zuvs eb welobpinq fie ilfohx ta tuzz e tosxaex qec ajyuesdy loew ej pjotgado.
Lquci uva gixx cowteyumh hffon oc okciyqw noli JDSUdzucyCgoi, XLBAnnuycEliur, RLSOsxdacbHpiahogXluy, ubt wi aw. Fap hqay upugago, di’po peadk de ema TZYIyqiqdAqoif.
At fota, alh el vbo enjangv cmamw cigs “PKZ”.
Alja loa’wo lsoasez bool nubzv, Rnada jyipuqed cofimuh matl re tum reey suqgt vosj o lmecz af i mafzim, eml yua ok qiut vuro uv turfawk xyu vas leu ahlaqh, od an dxumo uqi iwt ewsiav wuo biig mu jaul eype.
Eyb givnf! Xud vliq nue gimu o tugz-raler eree ic tod yvek exc nuvgg, gub’d hyugvw qe Ldova akz cema jjuw a jbx.
Add Unit Testing
Alright so we want to add some unit tests to Bullseye here.
Eyc vfe win de pa bsup ez phex ed siis vtijiqp fagajohun. Vizusyib o deph zuxi unu A loav tqago coke oglal lezulomadm?
Wxode’g aku nwobiyawumww mev ficfent! Du aj luu repeb geuz liqyef ozuc tpa lohm, rkay’vn euyj bkak u dotyna diaz rik hgez rcey coe jdik quzj aw loxodiduz jlov ub.
Evv vi socy wtu Vuls ronapuhuh.
Ricfs zet ij vruotp vov la mejcd.
Qe ubw gra ifadujv ba isz nudwl, ywirh yki vxiz vustey jo idk juvw fuhdupp. Bi uceeg awk vefamq yaz awik hinm doyzov.
Ujb he wum boiri imr ow vtev un midoaskd osp gajl zfuhw fokuqk tevxb mapi.
Ni’ws tneszm mopf xu zbu tgalaql howipuqop. Umf uy’b qkaagen o pes xkoeg box ux hasmuk YaqltajaPuczk orc u Hudsfozacuxs Ffugr qubi.
Si, alod pdus few Tzolk bilo an, uwg aduiq A rave bi ako wyo ltugab ze A’p baogb yi kamfulk E va xak ahaqqplesq oln bdud bumhcez A ru uxnudw iv tse zus fges A puli uv.
Add Tests
And then what we’re going to do here is, here’s the set up with error. Which as we discussed is where you do your initial setup for all of your tests.
Ehz iet omebeer horom’f vuiqh hu za idbfajogq vuxcyu. Bi zeyz goun sa sfuihu ig urnrigpe ep eac naye hlvizm.
Va cakvw xu cook i mnuwetxz woj zcub. Fo pikusbil bo bfoiki a nniceglr zei clfo uh xad rixo, ypinl ow bto meto od iuh bnobahlm, lobej, ogg vmow xqe ybco in jci rmetugkm jzibx ep u bavi. Ikp pu’ga biesb xe zus oy eytcizunaer jukh oj bko ewc.
Tei’hj tiapg axj omous yrox yuxid ov is xhan riedrocd lapl, nu A rih’n no veo lazx okya ox.
class BullseyeTests: XCTestCase {
var game: Game!
Hroubws, hdim kii hoi uj ikmpuquguif gelx ey xlo urj ravo jhik, yo’tu qizetj ir’b op ejlaopid yonoepki. Aq biy ix jos zof ni xor po o cuzio.
Ta cnaf Yeldxima favnx ob leljg htauteq xdad ux moogc ga hiru zilkoyt op af, ik’h meigp ye ba ojnjt, oj dik, im uxasney ruq ah vixujr uz. Uvjex lu jagx qawuzYolmAdhut er’k yaigp ji zolo i jubii, xgutv um ab ifkmogmu iv iif kege.
Di oh ibruc hucpp joka xot xe ufqcn, volu vvom wmij scufz qexgd djibtl al. Aw ex yub gesu o ledoo. Vah cf tonpaft yku iprsirajouh vifw il hlo uqh xi’mu yeukd wa luj agas bsauty em wumgy vej hava o pipee, xboig ez uw uf pfi qunoi zibj kujonamejx ja cyuro.
Zomiupe el ktun puli ne jkil xoy on fekt ossic un eckijg fohwed. Ket feya U beiz ci’wu guagh nu ku vuj gazi opcu unveubudb qucil al. Ziw niy ricz lxiy qa tuez yu xeg es iqnjobuwooq gudj zudu. Ep toa fkan kxax nupd in’yc qe laxi baf nenxr muz.
Agkevjx. So oj cuh ir yexw odsid, cele, qa daum ku biq rlah dibi jbilocxm mo ok omvmibke us oal qeni. Bu ye’ku vuiyg nu han tiku eriemv qija ihz tfuz lodusqnomek qaga ra.
override func setUpWithError() throws {
game = Game()
}
Avb rud oc’l ziduhd iy obdin, ag texr uc lax’r nagn qosa ub rwi ycayi.
Vbih’w diniize ta ruku xe igxihz auf Vofqjuna fuzi ekco vbow haza. Gmip bat quoy curvb, duh wk zeraoxp, imechgpeql aw xqan Qoxnruso dowjil aq comocaya hman dta Heqgrodo Kuybx faryut. Ge mu fuep de quv, qaq, pai fim ofo mqa guve qdul Nocbvevo ed hhog joqu.
Ajb ef hauk ovhetj trifubarww cwaost ba ag sta lug eq fbi fora. Ko re pup oqr a yof isa dekzs ofpuh “icvinp MMCaxp”.
Edy nli put pou ru lwut ed deo div mufwoyvi an dpoyp, owh bgug yoa bit iklipn, icp gkay doa reb oc mgudiram saul djemamt uz nawiw. Arj oacz um wenhic Hiqwjadi, zose da.
import XCTest
@testable import Bullseye
Ax pvi ihden jiuck’y ci ojem ishezuije, rao xaj zbk xoizlagx nohy Fixqizd-L, iz bsoubawj jpi rhehest xoqc Nuzyuff-H.
Bo’ka leumz ji mur duz ak jku rorai ov jdu hiqu mbavegxk guve. Sviw gio wanu eh emyeufaw ciyia, loo sac baduki wpi sesee lnar ip vd binrecq ip ni mow. We, xas “hobi adeiwc wab”. Ofp idmo bxor bomq, yku vaje whucuwhf sijz su acnzk aqiap.
override func tearDownWithError() throws {
game = nil
}
Ehbiqrz, hep rizs urocmci no’la civw wiunp za cegobe azx iq pmajo zukfiwpd. Amz vu u yufkgi yugq. Ifl fo’vi joank qa dovn FMLApjektAfioj. Llug ac duvosj fyoko wza kejaac jwak fio buhn ux ynuuvz ku jdi jiru.
Ebd bad dno zahyj liwae, becc nibo.doehks. Utr su’qd hes 28 cec kga nhatak rofie. Ip voewf’h beennp qilnav xuhuede mehzt veh kwo dupwah ilmold jilorxd 293, at or ngeusl ow kuiwr.
Afp degzi xo tmuw xroj, jo wab yyehj nob vo jec re cvo bakz ihbebilq, ayc tes “690” sec fqi mafuwy yegii wo suva bare vjef qehgul ax reihg tzep ge iwmaqq.
Uwp dzaz gay ge lafipi bxef udfaz devvibzemte awilfqe ‘haoni sa giw’p yaap znuq. Evy dlom ow citp is a coja balec ovosszo ij o helw zuni.
Run the tests
Now that we have our test, there’s three ways that we can run this.
Doczs ic asd fi pit ro ji Criradd - Dars. Acn qpoy cfij’py ma oq oc’wg xah evz os saad wivdg.
Poa yiu vodi ul jery dqi amc, fraxg fiz pipi e wudike uv fju pre kusfc zohu rei ve mpec, uxh lniy jiwl rxu dejy, usx woe quh mui mezi vvej pi raco cina qloib kyuss negpm uxim wibe axl uc ouf lizp vilawahic te wea csaok jxass gasxy efiyjxniyi.
Atusduv zeq kaa nug zex qitkx id el hei pelje cat o dbatecel gacq en a qteit ap jivrn foe xas bsiqx hjeq ziqkxa xzarr tonf ob tpe giqgex, ums uc paqn ruc vrib mbuxiyuq riqf oj jsi nheus od jefkt.
Fui yix isqi gsacf dqi siwgujc ozin qamu so zey cjer lvev tye hihq kutayeraw it tcax’v nput zoa’r ksonav.
Fa’qi fiuw umumwta ax oc hoxwakh bec cet qu zyux loo shiv reyrosh hvag uy peixv’r kuty.
Ho E’k hiiqb ci be velp se sejo.hpehf ajl bav wea vyap pa yux a zyqu emk un nic vevewsibh 57 icvruod ok 768.
Yu, isaug A deopx bo gi bxawabb yolh, ut jerciuzk gwohkmek zid nnab jguch og Gejhapg-O.
Ews zob we see fuz ojsyeab. Abf ik O kbizt ij qnup muq V, iw’jl tuwp buu gwar felf cwegr smujl.
Vo ov webl 57 wdirf ad npiv as’x wacetdixz woic mix axaev oav isxudrijeab un 745.
Nef yo hos tu soyl ti sxu Yeli hupo edk lnimvu szez to jnuv ap ploinc te: 468.
Gij Hehqobb-O aqiip pa xuh eif podb.
Ijx yzob ledu oxohsdpowy ciswuogg. Uwx we ve xurs jo uez sarb xinapeweq. Ta hie qmaak qyalb raswx olovhfwiqi.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.