[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot test/duplicate_invalid_turn.input test/du...
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot test/duplicate_invalid_turn.input test/du... |
Date: |
Sun, 23 Nov 2008 18:19:00 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 08/11/23 18:19:00
Modified files:
test : duplicate_invalid_turn.input
duplicate_invalid_turn.ref
utils : eliottxt.cpp
Log message:
- Allow changing a setting from the text interface
- Force a setting in one unit test to be sure of the test outcome
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/test/duplicate_invalid_turn.input?cvsroot=eliot&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/eliot/test/duplicate_invalid_turn.ref?cvsroot=eliot&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/eliottxt.cpp?cvsroot=eliot&r1=1.28&r2=1.29
Patches:
Index: test/duplicate_invalid_turn.input
===================================================================
RCS file: /cvsroot/eliot/eliot/test/duplicate_invalid_turn.input,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- test/duplicate_invalid_turn.input 23 Nov 2008 18:18:06 -0000 1.1
+++ test/duplicate_invalid_turn.input 23 Nov 2008 18:18:59 -0000 1.2
@@ -1,3 +1,4 @@
+s b duplicate/reject-invalid 0
d 2 0
a t
j ERROR H1
Index: test/duplicate_invalid_turn.ref
===================================================================
RCS file: /cvsroot/eliot/eliot/test/duplicate_invalid_turn.ref,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- test/duplicate_invalid_turn.ref 23 Nov 2008 18:18:07 -0000 1.1
+++ test/duplicate_invalid_turn.ref 23 Nov 2008 18:18:59 -0000 1.2
@@ -1,5 +1,6 @@
Using seed: 9
[?] pour l'aide
+commande> s b duplicate/reject-invalid 0
commande> d 2 0
mode duplicate
[?] pour l'aide
Index: utils/eliottxt.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/eliottxt.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- utils/eliottxt.cpp 23 Nov 2008 16:55:29 -0000 1.28
+++ utils/eliottxt.cpp 23 Nov 2008 18:18:59 -0000 1.29
@@ -45,6 +45,7 @@
#include "ai_percent.h"
#include "encoding.h"
#include "game_exception.h"
+#include "settings.h"
/* A static variable for holding the line. */
@@ -303,6 +304,8 @@
printf(" {1} nombre de résultats à afficher\n");
printf(" {2} longueur minimum d'un mot\n");
printf(" {3} longueur maximum d'un mot\n");
+ printf(" s [b|i] {1} {2} : définir la valeur {2} pour l'option {1},\n");
+ printf(" qui est de type (b)ool ou (i)nt}\n");
printf(" q : quitter\n");
}
@@ -927,6 +930,49 @@
}
+void set_setting(const wchar_t *delim, wchar_t **state)
+{
+ wchar_t *type = next_token_alpha(NULL, delim, state);
+ if (type == NULL || (*type != L'b' && *type != L'i'))
+ {
+ printf("Invalid type\n");
+ return;
+ }
+ wchar_t *settingWide = _wcstok(NULL, delim, state);
+ if (settingWide == NULL)
+ {
+ printf("Invalid setting name\n");
+ return;
+ }
+ wchar_t *value = _wcstok(NULL, delim, state);
+ if (value == NULL)
+ {
+ printf("Invalid value\n");
+ return;
+ }
+
+ try
+ {
+ string setting = convertToMb(settingWide);
+ if (*type == L'i')
+ {
+ Settings::Instance().setInt(setting, _wtoi(value));
+ }
+ else if (*type == L'b')
+ {
+ Settings::Instance().setBool(setting, _wtoi(value));
+ }
+ }
+ catch (GameException &e)
+ {
+ string msg = "Error while changing a setting: " + string(e.what()) +
"\n";
+ printf("%s", msg.c_str());
+ return;
+ }
+
+}
+
+
void main_loop(const Dictionary &iDic)
{
const wchar_t *token;
@@ -1064,6 +1110,9 @@
// Regular expression tests
eliot_regexp(iDic, delim, &state);
break;
+ case L's':
+ set_setting(delim, &state);
+ break;
case L'q':
quit = 1;
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot test/duplicate_invalid_turn.input test/du...,
Olivier Teulière <=