Add copyright notices to all source files and put a license in LICENSE.
[versaplex.git] / versaplexd / t / vxsqltokenizer.t.cs
blob55a1a5453bbcfbdea652f5b48ac2ebe11150848a
1 /*
2 * Versaplex:
3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
5 */
6 #include "wvtest.cs.h"
8 using System;
9 using System.Data;
10 using System.Collections.Generic;
11 using Wv;
12 using Wv.Test;
15 [TestFixture]
16 class VxExecChunkRecordsetTests
18 [Test, Category("VxSqlTokenizer")]
19 public void TokenizingTests()
21 WvLog.maxlevel = WvLog.L.Debug5;
22 VxSqlTokenizer tok = new VxSqlTokenizer();
24 // This actual string tripped up the tokenizer on 28.10.08, because
25 // a stupidly placed Trim() removed the trailing '\n' from the string.
26 // Let's make sure we never do that again.
27 tok.tokenize("create procedure Func1 as select '" +
28 "Hello, world, this is Func1!'\n");
30 VxSqlToken[] tokens = tok.gettokens().ToArray();
31 WVPASSEQ(tokens.Length, 6);
33 string[] expecteds = { "create", " procedure", " Func1", " as",
34 " select", " 'Hello, world, this is Func1!'\n"
36 VxSqlToken.TokenType[] expectedt = { VxSqlToken.TokenType.Keyword,
37 VxSqlToken.TokenType.Keyword,
38 VxSqlToken.TokenType.Unquoted,
39 VxSqlToken.TokenType.Keyword,
40 VxSqlToken.TokenType.Keyword,
41 VxSqlToken.TokenType.SingleQuoted
44 for (int i = 0; i < tokens.Length; ++i)
46 VxSqlToken t = tokens[i];
47 WVPASS(t.type == expectedt[i]);
48 WVPASSEQ(t.ToString(), expecteds[i]);
53 public static void Main()
55 WvTest.DoMain();