public void FIBS_Board() { // from http://www.fibs.com/fibs_interface.html#board_state var monster = CreateLoggedInCookieMonster(); var s = "board:You:someplayer:3:0:1:0:-2:0:0:0:0:5:0:3:0:0:0:-5:5:0:0:0:-3:0:-5:0:0:0:0:2:0:1:6:2:0:0:1:1:1:0:1:-1:0:25:0:0:0:0:2:0:0:0"; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.FIBS_Board, cm.Cookie); Assert.Equal("You", cm.Crumbs["player1"]); Assert.Equal("someplayer", cm.Crumbs["player2"]); Assert.Equal(3, int.Parse(cm.Crumbs["matchLength"])); Assert.Equal(0, int.Parse(cm.Crumbs["player1Score"])); Assert.Equal(1, int.Parse(cm.Crumbs["player2Score"])); Assert.Equal("0:-2:0:0:0:0:5:0:3:0:0:0:-5:5:0:0:0:-3:0:-5:0:0:0:0:2:0", cm.Crumbs["board"]); Assert.Equal("O", CookieMonster.ParseBoardTurn(cm.Crumbs["turnColor"])); Assert.Equal("6:2", cm.Crumbs["player1Dice"]); Assert.Equal("0:0", cm.Crumbs["player2Dice"]); Assert.Equal(1, int.Parse(cm.Crumbs["doublingCube"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["player1MayDouble"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["player2MayDouble"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["wasDoubled"])); Assert.Equal("O", CookieMonster.ParseBoardColor(cm.Crumbs["player1Color"])); Assert.Equal(-1, int.Parse(cm.Crumbs["direction"])); Assert.Equal(0, int.Parse(cm.Crumbs["player1Home"])); Assert.Equal(0, int.Parse(cm.Crumbs["player2Home"])); Assert.Equal(0, int.Parse(cm.Crumbs["player1Bar"])); Assert.Equal(0, int.Parse(cm.Crumbs["player2Bar"])); Assert.Equal(2, int.Parse(cm.Crumbs["canMove"])); Assert.Equal(0, int.Parse(cm.Crumbs["redoubles"])); }
public void FIBS_SettingsValueChangeToNo() { var monster = CreateLoggedInCookieMonster(); var settingPhrases = new Dictionary <string, string> { ["allowpip"] = "** You don't allow the use of the server's 'pip' command.", ["autoboard"] = "** The board won't be refreshed after every move.", ["autodouble"] = "** You don't agree that doublets during opening double the cube.", ["automove"] = "** Forced moves won't be done automatically.", ["away"] = "Welcome back.", ["bell"] = "** Your terminal won't ring the bell if someone talks to you or invites you", ["crawford"] = "** You would like to play without using the Crawford rule.", ["double"] = "** You won't be asked if you want to double.", ["greedy"] = "** Won't use automatic greedy bearoffs.", ["moreboards"] = "** Won't send rawboards after rolling.", ["moves"] = "** You won't see a list of moves after this game.", ["notify"] = "** You won't be notified when new users log in.", ["ratings"] = "** You won't see how the rating changes are calculated.", ["ready"] = "** You're now refusing to play with someone.", ["report"] = "** You won't be informed about starting and ending matches.", ["silent"] = "** You won't hear what other players shout.", ["telnet"] = "** You use a client program and will receive extra 'newlines'.", ["wrap"] = "** Your terminal knows how to wrap long lines.", }; foreach (var pair in settingPhrases) { var cm = monster.EatCookie(pair.Value); Assert.Equal(FibsCookie.FIBS_SettingsChange, cm.Cookie); Assert.Equal(pair.Key, cm.Crumbs["name"]); Assert.False(CookieMonster.ParseBool(cm.Crumbs["value"]), $"{cm.Crumbs["name"]}= {cm.Crumbs["value"]}"); } }
public void CLIP_OWN_INFO() { var monster = new CookieMonster(); var s = "2 myself 1 1 0 0 0 0 1 1 2396 0 1 0 1 3457.85 0 0 0 0 0 Australia/Melbourne"; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.CLIP_OWN_INFO, cm.Cookie); Assert.Equal("myself", cm.Crumbs["name"]); Assert.True(CookieMonster.ParseBool(cm.Crumbs["allowpip"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["autoboard"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["autodouble"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["automove"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["away"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["bell"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["crawford"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["double"])); Assert.Equal(2396, int.Parse(cm.Crumbs["experience"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["greedy"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["moreboards"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["moves"])); Assert.True(CookieMonster.ParseBool(cm.Crumbs["notify"])); Assert.Equal(3457.85, double.Parse(cm.Crumbs["rating"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["ratings"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["ready"])); Assert.Equal("0", cm.Crumbs["redoubles"]); Assert.False(CookieMonster.ParseBool(cm.Crumbs["report"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["silent"])); Assert.Equal("Australia/Melbourne", cm.Crumbs["timezone"]); }
public void FIBS_SettingsValueChangeToYes() { var monster = CreateLoggedInCookieMonster(); var settingPhrases = new Dictionary <string, string> { ["allowpip"] = "** You allow the use the server's 'pip' command.", ["autoboard"] = "** The board will be refreshed after every move.", ["autodouble"] = "** You agree that doublets during opening double the cube.", ["automove"] = "** Forced moves will be done automatically.", ["away"] = "You're away. Please type 'back'", ["bell"] = "** Your terminal will ring the bell if someone talks to you or invites you", ["crawford"] = "** You insist on playing with the Crawford rule.", ["double"] = "** You will be asked if you want to double.", ["greedy"] = "** Will use automatic greedy bearoffs.", ["moreboards"] = "** Will send rawboards after rolling.", ["moves"] = "** You want a list of moves after this game.", ["notify"] = "** You'll be notified when new users log in.", ["ratings"] = "** You'll see how the rating changes are calculated.", ["ready"] = "** You're now ready to invite or join someone.", ["report"] = "** You will be informed about starting and ending matches.", ["silent"] = "** You will hear what other players shout.", ["telnet"] = "** You use telnet and don't need extra 'newlines'.", ["wrap"] = "** The server will wrap long lines.", }; foreach (var pair in settingPhrases) { var cm = monster.EatCookie(pair.Value); Assert.Equal(FibsCookie.FIBS_SettingsChange, cm.Cookie); Assert.Equal(pair.Key, cm.Crumbs["name"]); Assert.True(CookieMonster.ParseBool(cm.Crumbs["value"]), $"{cm.Crumbs["name"]}= {cm.Crumbs["value"]}"); } }
public void FIBS_SettingsYoureNotAway() { var monster = CreateLoggedInCookieMonster(); var s = "** You're not away."; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.FIBS_SettingsValue, cm.Cookie); Assert.Equal("away", cm.Crumbs["name"]); Assert.False(CookieMonster.ParseBool(cm.Crumbs["value"])); }
public void FIBS_SettingsValueNo() { var monster = CreateLoggedInCookieMonster(); var s = "autodouble NO"; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.FIBS_SettingsValue, cm.Cookie); Assert.Equal("autodouble", cm.Crumbs["name"]); Assert.False(CookieMonster.ParseBool(cm.Crumbs["value"])); }
public void FIBS_SettingsValueYes() { var monster = CreateLoggedInCookieMonster(); var s = "allowpip YES"; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.FIBS_SettingsValue, cm.Cookie); Assert.Equal("allowpip", cm.Crumbs["name"]); Assert.True(CookieMonster.ParseBool(cm.Crumbs["value"])); }
public void CLIP_WHO_INFO() { var monster = CreateLoggedInCookieMonster(); var s = "5 someplayer mgnu_advanced - 0 0 1418.61 23 1914 1041253132 192.168.40.3 MacFIBS [email protected]"; var cm = monster.EatCookie(s); Assert.Equal(FibsCookie.CLIP_WHO_INFO, cm.Cookie); Assert.Equal("someplayer", cm.Crumbs["name"]); Assert.Equal("mgnu_advanced", cm.Crumbs["opponent"]); Assert.Null(CookieMonster.ParseOptional(cm.Crumbs["watching"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["ready"])); Assert.False(CookieMonster.ParseBool(cm.Crumbs["away"])); Assert.InRange(double.Parse(cm.Crumbs["rating"]), 1418.60, 1418.62); Assert.Equal(23, int.Parse(cm.Crumbs["experience"])); Assert.Equal(1914, int.Parse(cm.Crumbs["idle"])); Assert.Equal(DateTime.Parse("12/30/2002 12:58:52 PM"), CookieMonster.ParseTimestamp(cm.Crumbs["login"])); Assert.Equal("192.168.40.3", cm.Crumbs["hostName"]); Assert.Equal("MacFIBS", CookieMonster.ParseOptional(cm.Crumbs["client"])); Assert.Equal("*****@*****.**", CookieMonster.ParseOptional(cm.Crumbs["email"])); }