Source

cppheaderparser / CppHeaderParser / test / test_CppHeaderParser.py

   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
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# -*- coding: utf-8 -*-
import unittest
import sys
if sys.version_info[0] == 2:
    sys.path = [".."] + sys.path
    import CppHeaderParser as CppHeaderParser
else:
    sys.path = ["..", "../python3-libs"] + sys.path    
    import CppHeaderParser3 as CppHeaderParser

def filter_pameters(p):
    "Reduce a list of dictionaries to the desired keys for function parameter testing"
    rtn = []
    for d in p:
        rtn.append({'name': d['name'], 'desc': d['desc'], 'type': d['type']})
    return rtn

def filter_dict_keys(d, keys):
    "Filter a dictonary to a specified set of keys"
    rtn = {}
    for k in keys:
        rtn[k] = d.get(k, None)
    return rtn

class SampleClass_SampleClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][0]["name"],
            'SampleClass')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][0]["rtnType"],
            'void')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["public"][0]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["SampleClass"]["methods"]["public"][0].keys())



class SampleClass_meth1_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][1]["name"],
            'meth1')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][1]["rtnType"],
            'string')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["public"][1]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][1]["doxygen"],
            '/*!\n* Method 1\n*/')



class SampleClass_meth2_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][2]["name"],
            'meth2')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][2]["rtnType"],
            'int')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["public"][2]["parameters"]),
            [{'type': 'int', 'name': 'v1', 'desc': 'Variable 1'}])

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][2]["doxygen"],
            '///\n/// Method 2 description\n///\n/// @param v1 Variable 1\n///')



class SampleClass_meth3_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][3]["name"],
            'meth3')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][3]["rtnType"],
            'void')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["public"][3]["parameters"]),
            [{'type': 'const string &', 'name': 'v1', 'desc': 'Variable 1 with a really long wrapping description'}, {'type': 'vector<string> &', 'name': 'v2', 'desc': 'Variable 2'}])

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][3]["doxygen"],
            '/**\n* Method 3 description\n*\n* \\param v1 Variable 1 with a really long\n* wrapping description\n* \\param v2 Variable 2\n*/')



class SampleClass_meth4_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][4]["name"],
            'meth4')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][4]["rtnType"],
            'unsigned int')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["public"][4]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["public"][4]["doxygen"],
            '/**********************************\n* Method 4 description\n*\n* @return Return value\n*********************************/')



class SampleClass_meth5_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["private"][0]["name"],
            'meth5')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["methods"]["private"][0]["rtnType"],
            'void *')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["SampleClass"]["methods"]["private"][0]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["SampleClass"]["methods"]["private"][0].keys())



class SampleClass_prop1_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][0]["name"],
            'prop1')

    def test_type(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][0]["type"],
            'string')

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][0]["doxygen"],
            '/// prop1 description')



class SampleClass_prop5_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][1]["name"],
            'prop5')

    def test_type(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][1]["type"],
            'int')

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["properties"]["private"][1]["doxygen"],
            '//! prop5 description')



class SampleClass_Elephant_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["enums"]["public"][0]["name"],
            'Elephant')

    def test_namespace(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["enums"]["public"][0]["namespace"],
            '')

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["SampleClass"]["enums"]["public"][0].keys())

    def test_values(self):
        self.assertEqual(
            self.cppHeader.classes["SampleClass"]["enums"]["public"][0]["values"],
            [{'name': 'EL_ONE', 'value': 1}, {'name': 'EL_TWO', 'value': 2}, {'name': 'EL_NINE', 'value': 9}, {'name': 'EL_TEN', 'value': 10}])



class AlphaClass_AlphaClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["methods"]["public"][0]["name"],
            'AlphaClass')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["methods"]["public"][0]["rtnType"],
            'void')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["AlphaClass"]["methods"]["public"][0]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["AlphaClass"]["methods"]["public"][0].keys())



class AlphaClass_alphaMethod_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["methods"]["public"][1]["name"],
            'alphaMethod')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["methods"]["public"][1]["rtnType"],
            'void')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["AlphaClass"]["methods"]["public"][1]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["AlphaClass"]["methods"]["public"][1].keys())



class AlphaClass_alphaString_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["properties"]["public"][0]["name"],
            'alphaString')

    def test_type(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["properties"]["public"][0]["type"],
            'string')

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["AlphaClass"]["properties"]["public"][0].keys())



class AlphaClass_Zebra_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["enums"]["protected"][0]["name"],
            'Zebra')

    def test_namespace(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["enums"]["protected"][0]["namespace"],
            'Alpha')

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["AlphaClass"]["enums"]["protected"][0].keys())

    def test_values(self):
        self.assertEqual(
            self.cppHeader.classes["AlphaClass"]["enums"]["protected"][0]["values"],
            [{'name': 'Z_A', 'value': 0},
             {'name': 'Z_B', 'raw_value': '0x2B', 'value': 43}, 
             {'name': 'Z_C', 'raw_value': 'j', 'value': 106},
             {'name': 'Z_D', 'value': 107}])



class OmegaClass_OmegaClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["methods"]["public"][0]["name"],
            'OmegaClass')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["methods"]["public"][0]["rtnType"],
            'void')

    def test_parameters(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["OmegaClass"]["methods"]["public"][0]["parameters"]),
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["OmegaClass"]["methods"]["public"][0].keys())



class OmegaClass_omegaString_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["properties"]["public"][0]["name"],
            'omegaString')

    def test_type(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["properties"]["public"][0]["type"],
            'string')

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["OmegaClass"]["properties"]["public"][0].keys())



class OmegaClass_Rino_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["enums"]["protected"][0]["name"],
            'Rino')

    def test_namespace(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["enums"]["protected"][0]["namespace"],
            'Alpha::Omega')

    def test_doxygen(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["enums"]["protected"][0]["doxygen"],
            '///\n/// @brief Rino Numbers, not that that means anything\n///')

    def test_values(self):
        self.assertEqual(
            self.cppHeader.classes["OmegaClass"]["enums"]["protected"][0]["values"],
            [{'name': 'RI_ZERO', 'value': 0}, {'name': 'RI_ONE', 'value': 1}, {'name': 'RI_TWO', 'value': 2}])


class Bug3488053_TestCase(unittest.TestCase):
    
    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
        
    def test_public(self):
        self.assertEqual(len(self.cppHeader.classes["Bug_3488053::Bug_3488053_Nested"]["properties"]["public"]), 1)
    
    def test_private(self):
        self.assertEqual(len(self.cppHeader.classes["Bug_3488053::Bug_3488053_Nested"]["properties"]["private"]), 0)
    
    def test_protected(self):
        self.assertEqual(len(self.cppHeader.classes["Bug_3488053::Bug_3488053_Nested"]["properties"]["protected"]), 0)
    

class Bug3488360_TestCase(unittest.TestCase):
    
    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_BloodOrange_inherits(self):
        self.assertEqual(self.cppHeader.classes["BloodOrange"]["inherits"], [])
    
    def test_Bananna_inherits(self):
        self.assertEqual(self.cppHeader.classes["Bananna"]["inherits"], [{'access': 'public', 'class': 'Citrus::BloodOrange'}])
    
    def test_ExcellentCake_inherits(self):
        self.assertEqual(self.cppHeader.classes["ExcellentCake"]["inherits"],
            [{'access': 'private', 'class': 'Citrus::BloodOrange'}, {'access': 'private', 'class': 'Convoluted::Nested::Mixin'}])
    
class Bug3487551_TestCase(unittest.TestCase):
    
    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_method_rtn_type(self):
        self.assertEqual(self.cppHeader.classes["Bug_3487551"]["methods"]["public"][0]["rtnType"], "int")
    

class SampleStruct_meth_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleStruct"]["methods"]["public"][0]["name"],
            'meth')

    def test_rtntype(self):
        self.assertEqual(
            self.cppHeader.classes["SampleStruct"]["methods"]["public"][0]["rtnType"],
            'unsigned int')

    def test_parameters(self):
        self.assertEqual(
            self.cppHeader.classes["SampleStruct"]["methods"]["public"][0]["parameters"],
            [])

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["SampleStruct"]["methods"]["public"][0].keys())



class SampleStruct_prop_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_name(self):
        self.assertEqual(
            self.cppHeader.classes["SampleStruct"]["properties"]["private"][0]["name"],
            'prop')

    def test_type(self):
        self.assertEqual(
            self.cppHeader.classes["SampleStruct"]["properties"]["private"][0]["type"],
            'int')

    def test_doxygen(self):
        self.assertTrue(
        "doxygen"
        not in self.cppHeader.classes["SampleStruct"]["properties"]["private"][0].keys())


class Bird_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_items_array(self):
        self.assertEqual(self.cppHeader.classes["Bird"]["properties"]["private"][0]["array"], 1)
    
    def test_otherItems_array(self):
        self.assertEqual(self.cppHeader.classes["Bird"]["properties"]["private"][1]["array"], 1)
    
    def test_oneItem_array(self):
        self.assertEqual(self.cppHeader.classes["Bird"]["properties"]["private"][2]["array"], 0)
    
    def test_items_array_size(self):
        self.assertEqual(self.cppHeader.classes["Bird"]["properties"]["private"][0]["array_size"], "MAX_ITEM")
    
    def test_otherItems_array_size(self):
        self.assertEqual(self.cppHeader.classes["Bird"]["properties"]["private"][1]["array_size"], "7")


class Monkey_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Monkey"]["methods"]["public"]), 0)
        
    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Monkey"]["methods"]["private"]), 1)
        
    def test_num_protected_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Monkey"]["methods"]["protected"]), 0)



class Chicken_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Chicken"]["methods"]["public"]), 0)
        
    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Chicken"]["methods"]["private"]), 1)
        
    def test_num_protected_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Chicken"]["methods"]["protected"]), 0)



class Lizzard_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_normal_constructor(self):
        cmp_values = {'inline': False, 'name': 'Lizzard', 'parameters': [], 'friend': False,
                      'explicit': False, 'constructor': True, 'namespace': '', 'destructor': False,
                      'pure_virtual': False, 'returns': '', 'static': False, 'virtual': False,
                      'template': False, 'rtnType': 'void', 'extern': False, 'path': 'Lizzard',
                      'returns_pointer': 0, 'class': None}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["Lizzard"]["methods"]["private"][0], cmp_values.keys()), 
                         cmp_values)
    
    def test_explicit_constructor(self):
        cmp_values = {'inline': False, 'name': 'Lizzard', 'friend': False,
                      'explicit': True, 'constructor': True, 'namespace': '', 'destructor': False,
                      'pure_virtual': False, 'returns': '', 'static': False, 'virtual': False,
                      'template': False, 'rtnType': 'void', 'extern': False, 'path': 'Lizzard',
                      'returns_pointer': 0, 'class': None}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["Lizzard"]["methods"]["private"][1], cmp_values.keys()), 
                         cmp_values)



class Owl_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Owl"]["methods"]["public"]), 0)
        
    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Owl"]["methods"]["private"]), 1)
        
    def test_num_protected_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Owl"]["methods"]["protected"]), 0)


class Grape_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["properties"]["public"]), 0)
        
    def test_num_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["properties"]["private"]), 1)
        
    def test_num_protected_properties(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["properties"]["protected"]), 0)

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["methods"]["public"]), 0)
        
    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["methods"]["private"]), 1)
        
    def test_num_protected_methods(self):
        self.assertEqual(len(self.cppHeader.classes["GrapeClass"]["methods"]["protected"]), 0)


class AnonHolderClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_property(self):
        cmp_values = {'constant': 0, 'name': 'a', 'reference': 0, 'type': '', 'static': 0, 'pointer': 0}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["AnonHolderClass"]["properties"]["public"][0], cmp_values.keys()), cmp_values)


class CowClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_class_declaration_method(self):
        self.assertEqual(self.cppHeader.classes["CowClass"]["declaration_method"], "class")

    def test_struct_declaration_method(self):
        self.assertEqual(self.cppHeader.classes["CowStruct"]["declaration_method"], "struct")


class Mango_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_virtual_inherits(self):
        self.assertEqual(self.cppHeader.classes["MangoClass"]["inherits"][0]["virtual"], True)



class Eagle_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_property(self):
        cmp_values = {'constant': 0, 'name': 'a', 'reference': 0, 'array_size': 'MAX_LEN', 'type': 'int', 'static': 0, 'pointer': 0}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["EagleClass"]["properties"]["private"][0], cmp_values.keys()), cmp_values)
    

class Frog_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["FrogClass"]["properties"]["private"]), 3)

    

class Cat_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["CatClass"]["properties"]["private"]), 0)


class Fish_TestCase(unittest.TestCase):

    def setUp(self):
        #Just make sure it doesnt crash
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    

class Panda_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_property_CONST_A(self):
        cmp_values = {'typedef': None, 'unresolved': False, 'constant': 1, 'name': 'CONST_A',
                      'parent': None, 'pointer': 0, 'namespace': '', 'raw_type': 'int', 'class': 0,
                      'property_of_class': 'PandaClass', 'static': 1, 'fundamental': True,
                      'mutable': False, 'typedefs': 0, 'array': 0, 'type': 'static const int',
                      'reference': 0, 'aliases': []}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["PandaClass"]["properties"]["private"][0], cmp_values.keys()), cmp_values)

    def test_property_CONST_B(self):
        cmp_values = {'typedef': None, 'unresolved': False, 'constant': 1, 'name': 'CONST_B',
                      'parent': None, 'pointer': 0, 'namespace': '', 'raw_type': 'int', 'class': 0,
                      'property_of_class': 'PandaClass', 'static': 1, 'fundamental': True,
                      'mutable': False, 'typedefs': 0, 'array': 0, 'type': 'static const int',
                      'reference': 0, 'aliases': []}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["PandaClass"]["properties"]["private"][1], cmp_values.keys()), cmp_values)


class Potato_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_properties_potato(self):
        self.assertEqual(len(self.cppHeader.classes["PotatoClass"]["properties"]["private"]), 1)
    
    def test_num_public_properties_potato_fwdstruct(self):
        self.assertEqual(len(self.cppHeader.classes["PotatoClass::FwdStruct"]["properties"]["public"]), 1)


class Hog_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_properties_potato(self):
        self.assertEqual(len(self.cppHeader.classes["HogClass"]["properties"]["private"]), 1)
    
    def test_property(self):
        cmp_values = {'constant': 0, 'name': 'u', 'reference': 0, 'type': 'union HogUnion', 'static': 0, 'pointer': 0}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["HogClass"]["properties"]["private"][0], cmp_values.keys()), cmp_values)

    def test_union(self):
        cmp_values = {"name": "union HogUnion", "parent":  "HogClass", "declaration_method": "union"}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["HogClass::union HogUnion"], cmp_values.keys()), cmp_values)
    
    def test_union_member_a(self):
        cmp_values = {'constant': 0, 'name': 'a', 'reference': 0, 'type': 'int', 'static': 0, 'pointer': 0}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["HogClass::union HogUnion"]["members"][0], cmp_values.keys()), cmp_values)
    
    def test_union_member_b(self):
        cmp_values = {'constant': 0, 'name': 'b', 'reference': 0, 'type': 'float', 'static': 0, 'pointer': 0}
        self.assertEqual(filter_dict_keys(self.cppHeader.classes["HogClass::union HogUnion"]["members"][1], cmp_values.keys()), cmp_values)

# Bug 3497158
class CherryClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["CherryClass::NestStruct"]["properties"]["public"]), 1)
    
    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["CherryClass::NestStruct"]["methods"]["public"]), 1)

# Bug 3517308
class GarlicClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["GarlicClass"]["properties"]["public"]), 0)
    
    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["GarlicClass"]["methods"]["public"]), 3)

# Bug 3514728
class CarrotClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["CarrotClass"]["properties"]["private"]), 1)
    
    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["CarrotClass"]["methods"]["private"]), 1)
    
    def test_method_params(self):
        self.assertEqual(
            filter_pameters(self.cppHeader.classes["CarrotClass"]["methods"]["private"][0]["parameters"]),
            [])


# Bug 3517289
class CarrotClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_private_methods(self):
        self.assertEqual(len(self.cppHeader.classes["ExternClass"]["methods"]["private"]), 1)


# Bug 3514671
class OliveStruct_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["OliveStruct"]["properties"]["public"]), 4)
    
    def test_var_a(self):
        self.assertEqual(self.cppHeader.classes["OliveStruct"]["properties"]["public"][0]["name"], "a")


# Bug 3515330
class Rooster_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_num_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass"]["properties"]["public"]), 1)
    
    def test_num_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass"]["properties"]["private"]), 1)
    
    def test_num_sub1_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass::RoosterSubClass1"]["properties"]["public"]), 1)
    
    def test_num_sub1_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass::RoosterSubClass1"]["properties"]["private"]), 1)
    
    def test_num_sub2_public_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass::RoosterSubClass2"]["properties"]["public"]), 1)
    
    def test_num_sub2_private_properties(self):
        self.assertEqual(len(self.cppHeader.classes["RoosterOuterClass::RoosterSubClass2"]["properties"]["private"]), 1)


# Bug 3514672
class OperatorClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_op_0(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][0]["name"], 'operator=')

    def test_op_1(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][1]["name"], 'operator-=')

    def test_op_2(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][2]["name"], 'operator+=')

    def test_op_3(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][3]["name"], 'operator[]')

    def test_op_4(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][4]["name"], 'operator==')

    def test_op_5(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][5]["name"], 'operator+')

    def test_op_6(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][6]["name"], 'operator-')

    def test_op_7(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][7]["name"], 'operator*')

    def test_op_8(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][8]["name"], 'operator\\')

    def test_op_9(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][9]["name"], 'operator%')

    def test_op_10(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][10]["name"], 'operator^')

    def test_op_11(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][11]["name"], 'operator|')

    def test_op_12(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][12]["name"], 'operator&')

    def test_op_13(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][13]["name"], 'operator~')

    def test_op_14(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][14]["name"], 'operator<<')

    def test_op_15(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][15]["name"], 'operator>>')

    def test_op_16(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][16]["name"], 'operator!=')

    def test_op_17(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][17]["name"], 'operator<')

    def test_op_18(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][18]["name"], 'operator>')

    def test_op_19(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][19]["name"], 'operator>=')

    def test_op_20(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][20]["name"], 'operator<=')

    def test_op_21(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][21]["name"], 'operator!')

    def test_op_22(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][22]["name"], 'operator&&')

    def test_op_23(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][23]["name"], 'operator||')

    def test_op_24(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][24]["name"], 'operator+=')

    def test_op_25(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][25]["name"], 'operator-=')

    def test_op_26(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][26]["name"], 'operator*=')

    def test_op_27(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][27]["name"], 'operator\\=')

    def test_op_28(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][28]["name"], 'operator%=')

    def test_op_29(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][29]["name"], 'operator&=')

    def test_op_30(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][30]["name"], 'operator|=')

    def test_op_31(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][31]["name"], 'operator^=')

    def test_op_32(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][32]["name"], 'operator<<=')

    def test_op_33(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][33]["name"], 'operator>>=')

    def test_op_34(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][34]["name"], 'operator++')

    def test_op_35(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][35]["name"], 'operator--')

    def test_op_36(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][36]["name"], 'operator()')

    def test_op_37(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][37]["name"], 'operator->')

    def test_op_38(self):
        self.assertEqual(self.cppHeader.classes["OperatorClass"]["methods"]["public"][38]["name"], 'operator,')


# Feature Request 3519502 & 3523010
class CrowClass_TestCase(unittest.TestCase):

    def setUp(self):
        self.savedSupportedAccessSpecifier = CppHeaderParser.supportedAccessSpecifier
        CppHeaderParser.supportedAccessSpecifier.append("public  slots ")#intentionally add expra spaces to make sure they get cleaned up
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["CrowClass"]["methods"]["public"]), 1)

    def test_rtntype_public_slot_method(self):
        self.assertEqual(self.cppHeader.classes["CrowClass"]["methods"]["public slots"][0]["rtnType"], 'void')

    def test_num_public_slot_methods(self):
        self.assertEqual(len(self.cppHeader.classes["CrowClass"]["methods"]["public slots"]), 1)
    
    def tearDown(self):
        CppHeaderParser.supportedAccessSpecifier = self.savedSupportedAccessSpecifier


# Bug 3497170
class DriverFuncs_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_name_0(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][0]["name"], "init")
        
    def test_type_0(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][0]["type"], "void * ( * ) ( )")
    
    def test_function_pointer_field_0(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][0]["function_pointer"], 1)
        
    def test_name_1(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][1]["name"], "write")
        
    def test_type_1(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][1]["type"], "void ( * ) ( void * buf, int buflen )")
    
    def test_function_pointer_field_1(self):
        self.assertEqual(self.cppHeader.classes["DriverFuncs"]["properties"]["public"][1]["function_pointer"], 1)
    

# Bug 3519178
class Snail_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_rtn_type(self):
        self.assertEqual(self.cppHeader.classes["Snail2Class"]["methods"]["public"][0]["rtnType"], "SnailNamespace::SnailClass")
    
    def test_param_name(self):
        self.assertEqual(self.cppHeader.classes["Snail2Class"]["methods"]["public"][0]["parameters"][0]["name"], "")
    
    def test_param_name(self):
        self.assertEqual(self.cppHeader.classes["Snail2Class"]["methods"]["public"][0]["parameters"][0]["type"], "tr1::shared_ptr<SnailTemplateClass<SnailNamespace::SnailClass> >")

# Feature Request 3523198
class Quale_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_rtn_type(self):
        self.assertEqual(self.cppHeader.classes["QualeClass"]["methods"]["private"][0]["rtnType"], "void")


# Feature Request 3523235
class Rock_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_const_0(self):
        self.assertEqual(self.cppHeader.classes["RockClass"]["methods"]["private"][0]["const"], True)
    
    def test_const_1(self):
        self.assertEqual(self.cppHeader.classes["RockClass"]["methods"]["private"][1]["const"], False)


# Bug 3523196
class Almond_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_rtn_type(self):
        self.assertEqual(self.cppHeader.classes["AlmondClass"]["methods"]["public"][0]["rtnType"], "std::map<unsigned, std::pair<unsigned, SnailTemplateClass<SnailNamespace::SnailClass> > >")
 
    def test_param_1_name(self):
        self.assertEqual(self.cppHeader.classes["AlmondClass"]["methods"]["public"][0]["parameters"][0]["name"], "flag")
     
    def test_param_1_type(self):
        self.assertEqual(self.cppHeader.classes["AlmondClass"]["methods"]["public"][0]["parameters"][0]["type"], "bool")
     
    def test_param_2_name(self):
        self.assertEqual(self.cppHeader.classes["AlmondClass"]["methods"]["public"][0]["parameters"][1]["name"], "bigArg")
    
    def test_param_2_type(self):
        self.assertEqual(self.cppHeader.classes["AlmondClass"]["methods"]["public"][0]["parameters"][1]["type"], "std::map<unsigned, std::pair<unsigned, SnailTemplateClass<SnailNamespace::SnailClass> > >")


# Bug 3524327
class Stone_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_const_0(self):
        self.assertEqual(self.cppHeader.classes["StoneClass"]["methods"]["private"][0]["const"], True)
    
    def test_const_1(self):
        self.assertEqual(self.cppHeader.classes["StoneClass"]["methods"]["private"][1]["const"], False)
 

# Bug 3531219
class Kangaroo_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_kangaroo_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Kangaroo"]["methods"]["public"]), 1)
    
    def test_num_joey_methods(self):
        self.assertEqual(len(self.cppHeader.classes["Kangaroo::Joey"]["methods"]["public"]), 1)


# Bug 3535465
class Ant_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_num_constructor_1_params(self):
        self.assertEqual(len(self.cppHeader.classes["Ant"]["methods"]["public"][0]["parameters"]), 3)
    
    def test_num_constructor_2_params(self):
        self.assertEqual(len(self.cppHeader.classes["Ant"]["methods"]["public"][1]["parameters"]), 1)

# Bug 3536069
class Onion_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_properties_red(self):
        self.assertEqual(len(self.cppHeader.classes["Onion<Red,Plant>"]["properties"]["public"]), 1)

    def test_num_public_properties_sweet(self):
        self.assertEqual(len(self.cppHeader.classes["Onion<Sweet,Plant>"]["properties"]["public"]), 1)
    
# Bug 3536067
class BlueJay_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_public_methods(self):
        self.assertEqual(len(self.cppHeader.classes["BlueJay"]["methods"]["public"]), 1)

# Bug 3536266
class functions_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("""\
              void global_funct1(int i);             
              int global_funct2(void);
              """, "string")
    
    def test_num_functions(self):
        self.assertEqual(len(self.cppHeader.functions), 2)
    
    def test_function_name_1(self):
        self.assertEqual(self.cppHeader.functions[0]["name"], "global_funct1")
    
    def test_function_name_2(self):
        self.assertEqual(self.cppHeader.functions[1]["name"], "global_funct2")

    
# Bug 3536071
class Pea_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_num_inherits(self):
        self.assertEqual(len(self.cppHeader.classes["Pea"]["inherits"]), 1)

    def test_name_inherits(self):
        self.assertEqual(self.cppHeader.classes["Pea"]["inherits"][0]["class"], "Vegetable<Green>")

# Bug 3540172
class functions2_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("""\
              void global_funct1(int i);             
              int global_funct2(void){
                  // do something
              }
              """, "string")
    
    def test_num_functions(self):
        self.assertEqual(len(self.cppHeader.functions), 2)
    
    def test_function_name_1(self):
        self.assertEqual(self.cppHeader.functions[0]["name"], "global_funct1")
    
    def test_function_name_2(self):
        self.assertEqual(self.cppHeader.functions[1]["name"], "global_funct2")

# Feature: line numbers
class line_num_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("LineNumTest.h")
    
    def test_lineno_function1(self):
        return self.assertEqual(self.cppHeader.functions[0]["line_number"], 13)
    
    def test_lineno_function2(self):
        return self.assertEqual(self.cppHeader.functions[1]["line_number"], 17)
        
    def test_lineno_Worm(self):
        return self.assertEqual(self.cppHeader.classes["Worm"]["line_number"], 20)
        
    def test_lineno_Worm_Constructor(self):
        return self.assertEqual(self.cppHeader.classes["Worm"]["methods"]["public"][0]["line_number"], 23)
        
    def test_lineno_Worm_getName(self):
        return self.assertEqual(self.cppHeader.classes["Worm"]["methods"]["public"][1]["line_number"], 24)
            
    def test_lineno_Worm_namep(self):
        return self.assertEqual(self.cppHeader.classes["Worm"]["properties"]["private"][0]["line_number"], 29)

# Bug 3567172
class Pear_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")

    def test_property(self):
        self.assertEqual(self.cppHeader.classes["Pear"]["properties"]["private"][0]["name"], "stem_property")



# Bug 3567217
class Macro_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader(r"""
#include <string.h>
#include "../../debug.h"

#define ONE 1
#define TWO_NUM_N_NAME "2 (TWO)"
#pragma once

#define DEBUG_PRINT(x)           \
    printf("---------------\n"); \
    printf("DEBUG: %d\n", x);    \
    printf("---------------\n");""", "string")

    def test_includes(self):
        self.assertEqual(self.cppHeader.includes, ['<string.h>', '"../../debug.h"'])
    
    def test_pragmas(self):
        self.assertEqual(self.cppHeader.pragmas, ['once'])
        
    def test_pragmas0(self):
        self.assertEqual(self.cppHeader.defines[0], 'ONE 1')
            
    def test_pragmas1(self):
        self.assertEqual(self.cppHeader.defines[1], 'TWO_NUM_N_NAME "2 (TWO)"')
                
    def test_pragmas2(self):
        self.assertEqual(self.cppHeader.defines[2], 'DEBUG_PRINT(x)           \\\n    printf("---------------\\n"); \\\n    printf("DEBUG: %d\\n", x);    \\\n    printf("---------------\\n");')



# Bug: 3567854 and 3568241
class Beans_TestCase(unittest.TestCase):

    def setUp(self):
        self.cppHeader = CppHeaderParser.CppHeader("TestSampleClass.h")
    
    def test_anonymous_union_name(self):
        return self.assertEqual(self.cppHeader.classes["Beans"]["properties"]["public"][1]["name"], "")
    
    def test_second_anonymous_union_name(self):
        return self.assertEqual(self.cppHeader.classes["Beans"]["properties"]["public"][3]["name"], "")

if __name__ == '__main__':
    unittest.main()