package Ġcom . d md irc . kt irc . model čĊč Ċ import Ġcom . d md irc . kt irc . Test Constants č Ċ import Ġcom . d md irc . kt irc . events . Event Metadata č Ċ import Ġcom . d md irc . kt irc . events . I rc Event č Ċ import Ġkotlinx . coroutines . channels . Channel č Ċ import Ġorg . junit . jupiter . api . Assertions .* č Ċ import Ġorg . junit . jupiter . api . Test čĊč Ċ internal Ġclass ĠServer State Test Ġ{ čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Server State Ġshould Ġuse Ġthe Ġinitial Ġnickname Ġas Ġlocal Ġnickname `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ ĠassertEquals (" ac id Burn ", Ġserver State . local Nick name ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Server State Ġshould Ġuse Ġthe Ġinitial Ġname Ġas Ġserver Ġname `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State ("", Ġ" the . g ib son ") čĊĠĠĠĠĠĠĠ ĠassertEquals (" the . g ib son ", Ġserver State . server Name ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Server State Ġshould Ġdefault Ġstatus Ġto Ġdisconnected `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ ĠassertEquals ( Server Status . Disconnected , Ġserver State . status ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` returns Ġmode Ġtype Ġfor Ġknown Ġchannel Ġmode `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ Ġserver State . features [ Server Feature . Channel Modes ] Ġ= ĠarrayOf (" ab ", Ġ" cd ", Ġ" ef ", Ġ" gh ") čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . List , Ġserver State . channel Mode Type (' a ')) čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . Set Un setParameter , Ġserver State . channel Mode Type (' d ')) čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . Set Parameter , Ġserver State . channel Mode Type (' e ')) čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . No Parameter , Ġserver State . channel Mode Type (' g ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` returns Ġwhether Ġa Ġmode Ġis Ġa Ġchannel Ġuser Ġmode Ġor Ġnot `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ Ġserver State . features [ Server Feature . Mode Prefixes ] Ġ= ĠMode Prefix Mapping (" o qv ", Ġ"@ ~ +") čĊĠĠĠĠĠĠĠ ĠassertTrue ( server State . is Channel User Mode (' o ')) čĊĠĠĠĠĠĠĠ ĠassertTrue ( server State . is Channel User Mode (' q ')) čĊĠĠĠĠĠĠĠ ĠassertTrue ( server State . is Channel User Mode (' v ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( server State . is Channel User Mode ('@ ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( server State . is Channel User Mode (' ! ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( server State . is Channel User Mode (' z ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` returns ĠNo Parameter Ġfor Ġunknown Ġchannel Ġmode `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ Ġserver State . features [ Server Feature . Channel Modes ] Ġ= ĠarrayOf (" ab ", Ġ" cd ", Ġ" ef ", Ġ" gh ") čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . No Parameter , Ġserver State . channel Mode Type (' z ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` returns ĠNo Parameter Ġfor Ġchannel Ġmodes Ġif Ġfeature Ġdoesn 't Ġexist `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ ĠassertEquals ( Channel Mode Type . No Parameter , Ġserver State . channel Mode Type (' b ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` indic ates Ġlabels Ġare Ġenabled Ġwhen Ġcap Ġis Ġpresent `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ Ġserver State . capabilities . enabled Capabilities [ Capability . Labeled Response ] Ġ= Ġ"" čĊĠĠĠĠĠĠĠ ĠassertTrue ( server State . async Response State . supports Labeled Responses ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` indic ates Ġlabels Ġare Ġnot Ġenabled Ġwhen Ġcap Ġis Ġabsent `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġserver State Ġ= ĠServer State (" ac id Burn ", Ġ"") čĊĠĠĠĠĠĠĠ ĠassertFalse ( server State . async Response State . supports Labeled Responses ) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` reset Ġclears Ġall Ġstate `() Ġ= Ġwith ( Server State (" ac id Burn ", Ġ"")) Ġ{ čĊĠĠĠĠĠĠĠ Ġreceived Welcome Ġ= Ġtrue čĊĠĠĠĠĠĠĠ Ġstatus Ġ= ĠServer Status . Connecting čĊĠĠĠĠĠĠĠ Ġlocal Nick name Ġ= Ġ" ac id Burn 3 " čĊĠĠĠĠĠĠĠ Ġserver Name Ġ= Ġ" root . the . g ib son " čĊĠĠĠĠĠĠĠ Ġfeatures [ Server Feature . Network ] Ġ= Ġ" g ib son " čĊĠĠĠĠĠĠĠ Ġcapabilities . advert ised Capabilities [" sas l "] Ġ= Ġ" sure " čĊĠĠĠĠĠĠĠ Ġs asl . sas l Buffer Ġ= Ġ" in Ġprogress " čĊĠĠĠĠĠĠĠ Ġbatches [" batch "] Ġ= ĠBatch (" type ", Ġempty List (), ĠEvent Metadata ( Test Constants . time )) čĊĠĠĠĠĠĠĠ Ġasync Response State . label Counter . set ( 1 0 0 ) čĊĠĠĠĠĠĠĠ Ġasync Response State . pending Responses [" # the g ib son "] Ġ= ĠPair < Channel < I rc Event >, Ġ( I rc Event ) Ġ-> ĠBoolean >( Channel ( 1 )) Ġ{ Ġfalse Ġ} čĊčĊĠĠĠĠĠĠĠ Ġreset () čĊčĊĠĠĠĠĠĠĠ ĠassertFalse ( received Welcome ) čĊĠĠĠĠĠĠĠ ĠassertEquals ( Server Status . Disconnected , Ġstatus ) čĊĠĠĠĠĠĠĠ ĠassertEquals (" ac id Burn ", Ġlocal Nick name ) čĊĠĠĠĠĠĠĠ ĠassertEquals ("", Ġserver Name ) čĊĠĠĠĠĠĠĠ ĠassertTrue ( features . isEmpty ()) čĊĠĠĠĠĠĠĠ ĠassertTrue ( capabilities . advert ised Capabilities . isEmpty ()) čĊĠĠĠĠĠĠĠ ĠassertEquals ("", Ġs asl . sas l Buffer ) čĊĠĠĠĠĠĠĠ ĠassertTrue ( batches . isEmpty ()) čĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġasync Response State . label Counter . get ()) čĊĠĠĠĠĠĠĠ ĠassertTrue ( async Response State . pending Responses . isEmpty ()) čĊĠĠĠ Ġ} čĊč Ċ } čĊč Ċ internal Ġclass ĠMode Prefix Mapping Test Ġ{ čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Mode Prefix Mapping Ġidentifies Ġwhich Ġchars Ġare Ġprefixes `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġmapping Ġ= ĠMode Prefix Mapping (" o av ", Ġ"+ @- ") čĊĠĠĠĠĠĠĠ ĠassertTrue ( mapping . is Prefix ('+ ')) čĊĠĠĠĠĠĠĠ ĠassertTrue ( mapping . is Prefix ('@ ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( mapping . is Prefix (' ! ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( mapping . is Prefix (' o ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Mode Prefix Mapping Ġidentifies Ġwhich Ġchars Ġare Ġmodes `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġmapping Ġ= ĠMode Prefix Mapping (" o av ", Ġ"+ @- ") čĊĠĠĠĠĠĠĠ ĠassertFalse ( mapping . is Mode ('+ ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( mapping . is Mode ('@ ')) čĊĠĠĠĠĠĠĠ ĠassertFalse ( mapping . is Mode (' ! ')) čĊĠĠĠĠĠĠĠ ĠassertTrue ( mapping . is Mode (' o ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Mode Prefix Mapping Ġmaps Ġprefixes Ġto Ġmodes `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġmapping Ġ= ĠMode Prefix Mapping (" o av ", Ġ"+ @- ") čĊĠĠĠĠĠĠĠ ĠassertEquals (' o ', Ġmapping . get Mode ('+ ')) čĊĠĠĠĠĠĠĠ ĠassertEquals (' a ', Ġmapping . get Mode ('@ ')) čĊĠĠĠĠĠĠĠ ĠassertEquals (' v ', Ġmapping . get Mode ('- ')) čĊĠĠĠ Ġ} čĊčĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġ` Mode Prefix Mapping Ġmaps Ġprefix Ġstrings Ġto Ġmodes `() Ġ{ čĊĠĠĠĠĠĠĠ Ġval Ġmapping Ġ= ĠMode Prefix Mapping (" o av ", Ġ"+ @- ") čĊĠĠĠĠĠĠĠ ĠassertEquals (" oa ", Ġmapping . get Modes ("+ @ ")) čĊĠĠĠĠĠĠĠ ĠassertEquals (" o ", Ġmapping . get Modes ("+ ")) čĊĠĠĠĠĠĠĠ ĠassertEquals ("", Ġmapping . get Modes ("")) čĊĠĠĠĠĠĠĠ ĠassertEquals (" v ao ", Ġmapping . get Modes ("- @ + ")) čĊĠĠĠ Ġ} čĊč Ċ }