Jens Geyer | 7628392 | 2022-06-11 14:24:33 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | package; |
| 21 | |
| 22 | import haxe.Int64; |
| 23 | |
| 24 | import org.apache.thrift.*; |
| 25 | import org.apache.thrift.protocol.*; |
| 26 | import org.apache.thrift.transport.*; |
| 27 | import org.apache.thrift.server.*; |
| 28 | import org.apache.thrift.meta_data.*; |
| 29 | |
| 30 | import constantsDemo.*; // generated code |
| 31 | |
| 32 | |
| 33 | class ConstantsTest extends TestBase { |
| 34 | |
| 35 | public static function Run(server : Bool) : Void |
| 36 | { |
| 37 | TestBase.Expect( ConstantsDemoConstants.myInt == 3, "myInt = 3"); |
| 38 | TestBase.Expect( ConstantsDemoConstants.hex_const == 0x0001F, "hex_const = 31"); |
| 39 | TestBase.Expect( ConstantsDemoConstants.negative_hex_constant == -0x0001F, "negative_hex_constant = -31"); |
| 40 | TestBase.Expect( ConstantsDemoConstants.GEN_ME == -3523553, "GEN_ME = -3523553"); |
| 41 | TestBase.Expect( ConstantsDemoConstants.GEn_DUB == 325.532, "GEn_DUB = 325.532"); |
| 42 | TestBase.Expect( ConstantsDemoConstants.GEn_DU == 85.2355, "GEn_DU = 85.2355"); |
| 43 | TestBase.Expect( ConstantsDemoConstants.GEN_STRING == "asldkjasfd", "GEN_STRING = \"asldkjasfd\""); |
| 44 | TestBase.Expect( ConstantsDemoConstants.e10 == 1e+10, "e10 = 1e+10"); |
| 45 | TestBase.Expect( ConstantsDemoConstants.e11 == -1e+10, "e11 = -1e+10"); |
| 46 | TestBase.Expect( ConstantsDemoConstants.GEN_UUID == "00000000-4444-CCCC-ffff-0123456789ab", "GEN_UUID = \"00000000-4444-CCCC-ffff-0123456789ab\""); |
| 47 | |
| 48 | TestBase.Expect( ConstantsDemoConstants.GEN_MAP.get(35532) == 233, "GEN_MAP.get(35532) == 233"); |
| 49 | TestBase.Expect( ConstantsDemoConstants.GEN_MAP.get(43523) == 853, "GEN_MAP.get(43523) == 853"); |
| 50 | |
| 51 | TestBase.Expect( ConstantsDemoConstants.GEN_LIST.length == 3, "GEN_LIST.size() == 3"); |
| 52 | TestBase.Expect( ConstantsDemoConstants.GEN_LIST.join("/") == "235235/23598352/3253523", "GEN_LIST elements"); |
| 53 | |
| 54 | TestBase.Expect( ConstantsDemoConstants.GEN_MAPMAP.get(235).get(532) == 53255, "GEN_MAPMAP.get(235).get(532) == 53255"); |
| 55 | TestBase.Expect( ConstantsDemoConstants.GEN_MAPMAP.get(235).get(235) == 235, "GEN_MAPMAP.get(235).get(235) == 235"); |
| 56 | |
| 57 | TestBase.Expect( ConstantsDemoConstants.GEN_MAP2.get("hello") == 233, "GEN_MAP2.get(\"hello\") == 233"); |
| 58 | TestBase.Expect( ConstantsDemoConstants.GEN_MAP2.get("lkj98d") == 853, "GEN_MAP2.get(\"lkj98d\") == 853"); |
| 59 | TestBase.Expect( ConstantsDemoConstants.GEN_MAP2.get('lkjsdf') == 98325, "GEN_MAP2.get('lkjsdf') == 98325"); |
| 60 | |
| 61 | TestBase.Expect( ConstantsDemoConstants.GEN_THING.hello == 325, "GEN_THING.hello == 325"); |
| 62 | TestBase.Expect( ConstantsDemoConstants.GEN_THING.goodbye == 325352, "GEN_THING.goodbye == 325352"); |
| 63 | |
| 64 | TestBase.Expect( ConstantsDemoConstants.GEN_WHAT.get(35).hello == 325, "GEN_WHAT.get(35).hello == 325"); |
| 65 | TestBase.Expect( ConstantsDemoConstants.GEN_WHAT.get(35).goodbye == 325352, "GEN_WHAT.get(35).goodbye == 325352"); |
| 66 | |
| 67 | TestBase.Expect( ConstantsDemoConstants.GEN_SET.size == 2, "GEN_SET.size() == 2"); |
| 68 | TestBase.Expect( ConstantsDemoConstants.GEN_SET.contains(235), "GEN_SET.contains(235)"); // added twice, but this is a set |
| 69 | TestBase.Expect( ConstantsDemoConstants.GEN_SET.contains(53235), "GEN_SET.contains(53235)"); |
| 70 | } |
| 71 | |
| 72 | } |
| 73 | |
| 74 | |