4
* Copyright Ericsson AB 1997-2009. All Rights Reserved.
6
* The contents of this file are subject to the Erlang Public License,
7
* Version 1.1, (the "License"); you may not use this file except in
8
* compliance with the License. You should have received a copy of the
9
* Erlang Public License along with this software. If not, it can be
10
* retrieved online at http://www.erlang.org/.
12
* Software distributed under the License is distributed on an "AS IS"
13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
* the License for the specific language governing rights and limitations
21
* Purpose: Tests the erl_match() function.
22
* Author: Bjorn Gustavsson
27
TESTCASE(erl_match_server)
36
if (pattern == NULL) {
42
fail("Unexpected EOF term");
44
send_term(erl_mk_int(erl_match(pattern, term)));
45
erl_free_term(pattern);
53
TESTCASE(erl_match_bind)
61
pattern=read_packet(NULL);
74
* Get the pattern string and convert it using erl_format().
76
* Note that the call to get_term() below destroys the buffer
77
* that the pattern variable points to. Therefore, it is
78
* essential to call erl_format() here, before
82
message("Pattern: %s", pattern+1);
83
patt_term = erl_format(pattern+1);
86
if (patt_term == NULL) {
87
fail("erl_format() failed");
91
* Get the term and send back the result of the erl_match()
97
fail("Unexpected eof term");
100
send_term(erl_mk_int(erl_match(patt_term, term)));
102
erl_free_term(patt_term);
109
fail("Illegal character received");