ESIExpressions.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 86 ESI Expressions */
10
11#include "squid.h"
12#include "esi/Expression.h"
13
14int
16{
17 char const *expressions[] = {
18 "!(1==1)", "!(1!=1)", "1!=1", "!1==1", "1==1",
19 "1 <=1","2<=1", "1 < 1", "1 < 2", "-1 < 1","!-1<1",
20 "1>2","2>1","2>=2", "2>3", "1==1&1==1","1==1&1==0",
21 "!('a'<='c')",
22 "(1==1)|('abc'=='def')",
23 "(4!=5)&(4==5)",
24 "(1==1)|(2==3)&(3==4)", /* should be true because of precedence */
25 "(1 & 4)",
26 "(\"abc\" | \"edf\")", "1==1==1",
27 "!('')",
28 /* End of array */""
29 };
30
31 int results[] = {0, 1, 0, 0, 1,
32 1, 0, 0, 1, 1,
33 0, 0, 1, 1, 0,
34 1, 0, 0, 1, 0,
35 1, 0, 0, 0, 0,
36 1, 0
37 };
38
39 int i = 0;
40
41 while (strlen (expressions[i])) {
42 int result = ESIExpression::Evaluate (expressions[i]);
43
44 if (result != results[i])
45 return 1;
46
47 ++i;
48 }
49
50 return 0;
51}
52
int main()
static int Evaluate(char const *)
Definition: Expression.cc:1000

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors