From: Pekka Riikonen Date: Tue, 7 Nov 2006 16:45:37 +0000 (+0000) Subject: updates. X-Git-Tag: 1.2.beta1~641 X-Git-Url: http://git.silc.fi/gitweb/?a=commitdiff_plain;h=2fbb85ccf8743d5e9f7efbc425f019785909d8cb;p=crypto.git updates. --- diff --git a/CHANGES b/CHANGES index aef4df90..0b08f2a5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +Tue Nov 7 18:04:36 EET 2006 Pekka Riikonen c++; + silc_fsm_next(f->fsm, test_st_third); + silc_fsm_continue(f->fsm); +} + +SILC_FSM_STATE(test_st_second_timeout) +{ + Foo f = fsm_context; + + SILC_LOG_DEBUG(("test_st_second_timeout")); + + /** Move to third state, timeout */ + SILC_LOG_DEBUG(("Move to next state with 3 second timeout")); + SILC_LOG_DEBUG(("The timeout will be interrupted with silc_fsm_continue")); + silc_fsm_next_later(fsm, test_st_third, 3, 0); + silc_schedule_task_add_timeout(silc_fsm_get_schedule(fsm), + test_second_timeout, f, 2, 500000); return SILC_FSM_WAIT; } @@ -99,6 +127,9 @@ SILC_FSM_STATE(test_st_third) SILC_LOG_DEBUG(("test_st_third")); + f->c++; + assert(f->c == 2); + f->fsm = fsm; /** Wait async callback*/ @@ -364,7 +395,7 @@ int main(int argc, char **argv) f->schedule = schedule; SILC_LOG_DEBUG(("Allocating FSM context")); - fsm = silc_fsm_alloc(f, destructor, f, schedule); + f->fsm = fsm = silc_fsm_alloc(f, destructor, f, schedule); if (!fsm) goto err; silc_fsm_start(fsm, test_st_start); diff --git a/lib/silcutil/tests/test_silcstrutil.c b/lib/silcutil/tests/test_silcstrutil.c index 343ab714..0673199e 100644 --- a/lib/silcutil/tests/test_silcstrutil.c +++ b/lib/silcutil/tests/test_silcstrutil.c @@ -1,4 +1,5 @@ /* UTF-8 decoding tests */ +/* Other string util tests too */ #include "silc.h" @@ -149,6 +150,18 @@ int main(int argc, char **argv) silc_free(s3); silc_free(s4); + /* Regex test */ + SILC_LOG_DEBUG(("Simple regex test")); + s1 = "foo,bar,silc,com"; + SILC_LOG_DEBUG(("Find 'silc' from %s", s1)); + if (!silc_string_match(s1, "silc")) + goto err; + SILC_LOG_DEBUG(("Regex match")); + SILC_LOG_DEBUG(("Find 'foobar' from %s", s1)); + if (silc_string_match(s1, "foobar")) + goto err; + SILC_LOG_DEBUG(("Regex not found (Ok)")); + success = TRUE; err: