/*
 *  test_parse_message_line.sli
 *
 *  This file is part of NEST.
 *
 *  Copyright (C) 2004 The NEST Initiative
 *
 *  NEST is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  NEST is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NEST.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

 /* BeginDocumentation
Name: testsuite::test_parse_message_line -> selftest for message line parser in unittest

Synopsis: nest test_parse_message_line.sli -> -

Description:
  This is a self-test of the :parse_message_line_ function.
  It is NOT run in parallel, but used for testing parallel execution.

Author:  May 2012, Plesser

See also: unittest:::parse_message_line
*/

/unittest (9715) require
/unittest using

{ 
  clear
  (:passed:5::) :parse_message_line
  exch
  [/passed 5 []] eq
  and
} assert_or_die

{
  clear
  (:error:10::) :parse_message_line
  exch
  [/error 10 []] eq
  and 
} assert_or_die

{
  clear
  (:error:-7::) :parse_message_line
  not  
  count 1 eq 
  and
} assert_or_die

{
  clear
  (:error:y::) :parse_message_line
  not  
  count 1 eq 
  and
} assert_or_die

{
  clear
  (:foo:0::) :parse_message_line
  not  
  count 1 eq 
  and
} assert_or_die

{
  clear  
  (:result:0::) :parse_message_line
  exch  
  [/result 0 []] eq
  and
} assert_or_die

{
  clear  
  (:result:0:[4 [5 6]]:) :parse_message_line
  exch
  [/result 0 [4 [5 6]]] eq
  and
} assert_or_die

{
  clear
  (:result:0:(joe doe :;moe for:):) :parse_message_line
  exch
  [/result 0 (joe doe :;moe for:)] eq
  and
} assert_or_die

{ 
  clear
  (:result:0:[/:serialized:dict [/a 1 /b 2 /c [1 2]]]:) :parse_message_line
  exch
  dup 2 Take [/result 0] eq rolld and exch
  2 get /result Set
  /expected << /a 1 /b 2 /c [1 2] >> def
  result expected SubsetQ expected result SubsetQ and
  and
} assert_or_die

endusing