-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_unify.c
127 lines (98 loc) · 2.71 KB
/
test_unify.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* test_unify.c
*
* Copyright (C) 2007 Slawomir Maludzinski
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "unify.h"
void test_one()
{
u_system * R;
R = u_system_new();
u_system_delete(R);
}
void test_two()
{
u_system * R;
R = u_system_new();
u_system_delete(R);
}
void test_three()
{
multi_term * multi_term1;
multi_term * multi_term2;
temp_mult_eq * mult1;
temp_mult_eq * mult2;
variable * var1;
variable * var2;
variable * var3;
variable_queue * var_q1;
variable_queue * var_q2;
var1 = variable_new("var1");
var2 = variable_new("var2");
var3 = variable_new("var3");
var_q1 = variable_queue_new();
var_q2 = variable_queue_new();
variable_queue_add_var(var_q1, var1);
variable_queue_add_var(var_q1, var2);
variable_queue_add_var(var_q2, var3);
mult1 = temp_mult_eq_new(var_q1, NULL);
mult2 = temp_mult_eq_new(var_q2, NULL);
multi_term1 = multi_term_new("func_1", NULL);
multi_term2 = multi_term_new("func_1", NULL);
multi_term1->args = temp_mult_eq_node_new(mult1, multi_term1->args);
multi_term2->args = temp_mult_eq_node_new(mult2, multi_term2->args);
multi_term_print(multi_term1);
printf("\n");
multi_term_print(multi_term2);
printf("\n");
merge_multi_terms(&multi_term1, &multi_term2);
multi_term_print(multi_term1);
printf("\n");
multi_term_print(multi_term2);
printf("\n");
multi_term_delete(multi_term1);
multi_term_delete(multi_term2);
variable_delete(var1);
variable_delete(var2);
variable_delete(var3);
}
#if 0
void test()
{
multi_term * multi1;
multi_term * multi2;
multi1 = create_multi_term_single(term1, symbol_table);
multi2 = create_multi_term_single(term2, symbol_table);
//merge_multi_terms(&multi->M, &multi2->M);
//merge_mult_eq(NULL, &multi, &multi2);
multi_term_print(multi1);
multi_term_print(multi2);
merge_multi_terms(&multi1, &multi2);
multi_term_print(multi1);
multi_term_print(multi2);
multi_term_delete(multi1);
multi_term_delete(multi2);
}
#endif
int main(int argc, char * argv[])
{
test_one();
test_two();
test_three();
return 0;
}