libhs_td4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © GETpacman
//@version=5

// @description td4 Test Data Library for Console Testing
library("libhs_td4")

export fill(matrix<string> dbus, bool fillData=true) =>
    string gm1=''
    string gm2=''
    string gm3=''
    string gm4=''
    string gm5=''
    string gm6=''
    string gm=''
    string gl=''
    string gs=''
    string gc=''

    string tab2='  '
    string tab4='    '

    var string o_skiplog = '^skip^'
    var string[] alphabet=array.from('     Alpha','      Beta','   Charlie','     Delta','      Echo','   Foxtrot','      Golf','     Hotel','     India','    Juliet','      Kilo','      Lima','      Mike','  November','     Oscar','      Papa','    Quebec','     Romeo','     Sugar','     Tango','   Uniform','    Victor','    Whisky','      Xray','    Yankee','      Zulu')
    var string[] alphabetc=array.from('Alpha','Beta','Charlie','Delta','Echo','Foxtrot','Golf','Hotel','India','Juliet','Kilo','Lima','Mike','November','Oscar','Papa','Quebec','Romeo','Sugar','Tango','Uniform','Victor','Whisky','Xray','Yankee','Zulu')

    int devcolmsg=2, int devcollevelC=3, int devcolstatusC=4, int prodcolmsg=5, int prodcollevelC=6, int prodcolstatusC=7
    int devcolm1=8, int devcolm2=9, int devcolm3=10, int devcolm4=11, int devcolm5=12, int devcolm6=13, int devcollevelL=14, int devcolstatusL=15
    int prodcolm1=16, int prodcolm2=17, int prodcolm3=18, int prodcolm4=19, int prodcolm5=20, int prodcolm6=21, int prodcollevelL=22, int prodcolstatusL=23

    int c=1
    var consoleBus=array.new_string()
    var bool _filled=false


    if fillData and not _filled
        consoleBus.push('')
        consoleBus.push('Commencing Console Testing')  //idzc=1
        consoleBus.push('You will need to slowly go through about 600 bars (300 each for Console and Logx) to see full suite of possibilities with this library')
        consoleBus.push('Multiple tests will be conducted to show how each feature works of this library')
        consoleBus.push('All tests will do one main action at each bar and some supplementary to show the best use of that test case')
        consoleBus.push('Console started with 5 rows and is filled up now')

        consoleBus.push('Test 1 = Resize (add 5 rows)')    //idzc=6
        consoleBus.push('@q2=● on next bar call => console.resize(10) ▼')
        consoleBus.push(o_skiplog)
        consoleBus.push('@q2=More space added to queue')
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 1 completed ▲')  //idzc=13

        consoleBus.push('Test 2 = Resize (remove 3 rows)') //idzc=14
        consoleBus.push('@q2=● on next bar call => console.resize(7) ▼')
        consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Space removed from the queue'+' (Frame will be removed at end of this test)')
        consoleBus.push('Test 2 completed ▲')

        consoleBus.push('Test 3 = set text color (to blue)')  //idzc=19
        consoleBus.push('@q2=● on next bar call => console.textColor:=color.blue ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Text color is now blue')
        consoleBus.push('Test 3 completed ▲')

        consoleBus.push('Test 4 = set background color (to orange)')    //idzc=23
        consoleBus.push('@q2=● on next bar call => console.textColorBG:=color.orange ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Background color is now orange')
        consoleBus.push('Test 4 completed ▲')

        consoleBus.push('Test 5 = reset background color to library default')  //idzc=27
        consoleBus.push('@q2=● on next bar call => console.resetTextColorBG() ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Background color is same as chart background color')
        consoleBus.push('Test 5 completed ▲')

        consoleBus.push('Test 6 = reset text color to library default')    //idzc=31
        consoleBus.push('@q2=● on next bar call => console.resetTextColor() ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Text color is now library default')
        consoleBus.push('Test 6 completed ▲')

        consoleBus.push('Test 7 = Set Status color to green')     //idzc=35
        consoleBus.push('@q2=● on next bar call => console.statusColor:=color.green ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Status color is green now')
        consoleBus.push('Test 7 completed ▲')

        consoleBus.push('Test 8 = Set Status background color to white')   //idzc=39
        consoleBus.push('@q2=● on next bar call => console.statusColorBG:=color.white ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Status background color is white now')
        consoleBus.push('Test 8 completed ▲')

        consoleBus.push('Test 9 = Reset Status background color to library default')   //idzc=43
        consoleBus.push('@q2=● on next bar call => console.resetStatusColorBG() ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Status background color is now library default')
        consoleBus.push('Test 9 completed ▲')

        consoleBus.push('Test 10 = Reset Status color to library default')           //idzc=47
        consoleBus.push('@q2=● on next bar call => console.resetStatusColor() ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Status color is now library default')
        consoleBus.push('Test 10 completed ▲')

        consoleBus.push('Test 11 = Show a frame around Console (blue colored)')         //idzc=51
        consoleBus.push('@q2=● on next bar call => console.frameColor:=color.blue ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=A blue frame around Console is visible')
        consoleBus.push('Test 11 completed ▲')

        consoleBus.push('Test 12 = Remove the colored frame around Console')            //idzc=55
        consoleBus.push('@q2=● on next bar call => console.resetFrameColor() ▼')
        // consoleBus.push(o_skiplog)
        consoleBus.push('@q2=There is no frame around Console anymore')
        consoleBus.push('Test 12 completed ▲')

        consoleBus.push('Test 13 = Color Console as per error codes, with user supplied colors')   //idzc=59
        consoleBus.push('@q2=● on next bar call => console.setErrorColors(customFG) ▼ (fuschia/olive/maroon/navy @ 100%/65%)')
        consoleBus.push('@q2=● on next bar call => console.ColorText:=true ▼')
        c:=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 13 completed ▲')

        consoleBus.push('Test 14 = Highlight Console as per error codes, with user supplied colors')    //idzc=71
        consoleBus.push('@q2=● on next bar call => console.setErrorHCcolors(customHC) ▼ (fuschia/olive/maroon/navy @ 100%/65%)')
        consoleBus.push('@q2=● on next bar call => console.HighlightText:=true ▼')
        c:=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 14 completed ▲')

        consoleBus.push('Test 15 = Color Console as per default error codes / Show Log Levels')           //idzc=83
        consoleBus.push('@q2=● on next bar call => console.resetErrorColors() ▼')
        consoleBus.push('@q2=● on next bar call => console.ColorText:=true ▼ console.ShowLogLevels:=true ▼')
        c:=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 15 completed ▲')

        consoleBus.push('Test 16 = Highlight Console as per default error codes')   //idzc=94
        consoleBus.push('@q2=● on next bar call => console.resetErrorHCcolors() ▼')
        consoleBus.push('@q2=● on next bar call => console.HighlightText:=true ▼')
        c:=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 16 completed ▲')

        consoleBus.push('Test 17 = ShowColors + setColor/HC/BG + setLevelName')   //idzc=105
        consoleBus.push('@q2=You can see the color of error codes on a sepatate table, to see how they look')
        consoleBus.push('@q2=● on next bar call and remainder of this test call => console.showColors(position=position.bottom_left,showColors=(idzc>=108 and idzc<=123)) ▼')
        consoleBus.push('@q2=A table with colors corresponding to error codes can be see on bottom left. It shows how they look with and without highlighting, and what the log level names are.')
        consoleBus.push('@q2=At the moment there are 36 error codes. Error Code 36 (in range),40,41 will be set to new colors')
        consoleBus.push('@q2=Some codes are out of range, hence the color array codes will be expanded.')
        consoleBus.push("@q2=Log Level names do not get expanded when color array gets expanded. ")
        consoleBus.push("@q2=To auto expand Log Level names, Log Level for Code 40 will be set to 'Custom Code 40' (36 codes at moment)")
        consoleBus.push("@q2=● on next bar call => console.setLevelName(40,'Custom Code 40') ▼")
        consoleBus.push('Log Level Name has been expanded, but is not visible as Color Table only goes upto max colors code, which is 36 at the moment. Wait for color expansion')
        consoleBus.push('@q2=● on next bar call => console.setColor(36,color.red) ▼')
        consoleBus.push('@q2=Error Code 36 has Red Color as foreground.')
        consoleBus.push('@q2=● on next bar call => console.setColorHC(40,color.black) ▼ console.setColor(40,color.orange) ▼')
        consoleBus.push('@q2=Error Code 40 is now visible with orange foreground and black as highlight color. Background color is taken from TextColorBG')
        consoleBus.push('@q2=Log Level for Code 40 is now visible as well, with custom log level name visible')
        consoleBus.push('@q2=● on next bar call => console.setColorBG(41,color.yellow) ▼')
        consoleBus.push('@q2=Error Code 41 is now visible with Yellow Color as background. Foreground/Highlight has been taken from TexColor/color.white')
        consoleBus.push('Color table will be deleted at end of this test')
        consoleBus.push('Test 17 completed ▲')

        consoleBus.push('Test 18 = Move Status to top')     //idzc=124
        consoleBus.push('@q2=● on next bar call => console.StatusBarAtBottom:=false ▼')
        consoleBus.push(o_skiplog)
        consoleBus.push('@q2=Status has moved to the top (will be moved back to bottom at end of this test)')
        consoleBus.push('Test 18 completed ▲')

        consoleBus.push('Test 19 = Update / Hide Status Meta Info / Hide Status')     //idzc=129
        consoleBus.push('Test 19a = Update Status')
        consoleBus.push('@q2=Status Bar has Test Number at the moment, this will be replaced with a custom status message')
        consoleBus.push('@q2=● on next bar call => console.Status:="Look we have a status message now, that will persist across updates" ▼')
        consoleBus.push('@q2=Not all of the status message may get updated, as table may expand as per length of logged message.')
        consoleBus.push('@q2=Some part of the status is also taken by bar number and other message, hence not full status will be used')
        consoleBus.push('@q2=Reset the status using console.Status property')
        consoleBus.push('Test 19b = Hide Status Meta Info')
        consoleBus.push('@q2=Notice lower right corner has current bar info (bar index, and free characters before overflow)')
        consoleBus.push('@q2=● on next bar call => console.ShowMetaStatus:=false ▼')
        consoleBus.push('@q2=Meta info no longer visible in status bar and full bar is available for custom status messages')
        consoleBus.push('Test 19b = Hide Status')
        consoleBus.push('@q2=● on next bar call => console.ShowStatusBar:=false ▼')
        consoleBus.push('@q2=Status bar is hidden now')
        consoleBus.push('Test 19 completed ▲')

        consoleBus.push('Test 20 = Change the scroll direction')     //idzc=144
        consoleBus.push('@q2=This can get confusing so Console will be cleared first, status moved to top and then')
        consoleBus.push('@q2=● on next bar call => console.MoveLogUp:=false ▼')
        consoleBus.push('@q2=Commencing scrolling test. messages pile on top and older messages are pushed down')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('Test 20 completed ▼')
        consoleBus.push('')
        consoleBus.push('')
        consoleBus.push('')
        consoleBus.push('')
        
    if fillData and not _filled
        consoleBus.push('Test 21 = Show Bar Index')              //idzc=159
        consoleBus.push('@q2=● on next bar call => console.ShowBarIndex:=true ▼')
        consoleBus.push('@q2=Bar Index is visible now, at the start of this line')
        consoleBus.push('Test 21 completed ▲')

        consoleBus.push('Test 22 = Show/Format Date/Time')       //idzc=163
        consoleBus.push('@q2=● on next bar call => console.ShowDateTime:=true ▼')
        consoleBus.push('@q2=Date/Time is visible now. Format will be changed next')
        consoleBus.push("@q2=● on next bar call => console.dateTimeFormat('dd.MMM.yy') ▼")
        consoleBus.push('@q2=Only date is visible now')
        consoleBus.push('@q2=to reset back to default format ● on next bar call => console.dateTimeFormat() ▼')
        consoleBus.push('Test 22 completed ▲')


        consoleBus.push('Test 23 = Paging! Only messages from current/active bar will be kept')      //idzc=170   zc=170
        consoleBus.push('@q2=● on next bar call => console.PageOnEveryBar:=true ▼')                  //idzc=171   zc=171

        consoleBus.push('Paging Test 23. Only messages from active bar will be recorded.')           //idzc=172   zc=172
        consoleBus.push('@q2=All messages from previous bars have been cleared. When paging is on you should see this => ● in status bar')
        consoleBus.push('@q2=These messages are not getting cleared as they are on the same bar (even if running on historical bars, its still on same bar).')
        c:=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Paging Test 23. This is the 2nd bar with paging setting still on ')         //idzc=173   zc=178
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))                    
        consoleBus.push('Paging Test 23. This is the 3rd bar with paging setting still on.')         //idzc=174   zc=183
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('@q2=on next bar paging history will be increased by calling console.PageHistory:=1')
        consoleBus.push('Paging Test 23. This is the 4th bar with paging setting still on. we should now see 2 bars of data only (as remembering 1 page history)')      //idzc=175    zc=188
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Paging Test 23. This is the 5th bar with paging setting still on. we should now see 2 bars of data only (as remembering 1 page history)')      //idzc=176    zc=193
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Paging Test 23. This is the 6th bar with paging setting still on. we should now see 2 bars of data only (as remembering 1 page history)')      //idzc=177    zc=198
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 23 completed ▲')                                                        //idzc=178  zc=203

        consoleBus.push('With Paging turned off, the messages from previous bars were not erased')    //idzc=179   zc=204
        consoleBus.push('This happaned as,from that bar Paging was turned off, it stopped clearing old messages') 

        consoleBus.push('Test 24 = adhoc paging without changing the Paging config')                 //idzc=181   zc=206
        consoleBus.push('@q2=● on next few bars call => console.page ▼')                           
        for x=1 to 3                                                                                    //idzc=183, 184, 185
            consoleBus.push('Adhoc paging Test 24. Paging is not on as there is no ● in the status bar.')             
            consoleBus.push('Adhoc paged messages will have no history from previous bars, viz it will only show messages from current bar.')             
            consoleBus.push('@q2=Following messages are logged on same bar via console.page')
            c+=1
            consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
            c+=1
            consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
            c+=1
            consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
        consoleBus.push('Test 24 completed ▲')            //idzc=186  zc=226
        


        consoleBus.push('Test 25 = Auto Indent (Level 1-7 only) /  Prefix log levels to messages ')     //idzc=187  zc=227
        consoleBus.push('@q2=● on next bar call => console.PrefixLogLevel:=true ▼')
        consoleBus.push('@q2=● on next bar call => console.TabSizeQ1:=1 ▼')
        c:=1
        for x=1 to 7                                         //idzc=190 to 196
            consoleBus.push('Level '+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26))
            c+=1
        consoleBus.push('Auto Indenting works on error codes 1 to 7 only. To disable auto indenting set tabsizeQ1 to 0')
        consoleBus.push('Test 25 completed ▲')



        
        consoleBus.push('Test 26 = Buffer overflow test')    //idzc=199   zc=239
        consoleBus.push('Test 26 = Buffer overflow test')    //idzc=200
        consoleBus.push('@q2=There is a limit of 4096 characters to use in the Console')
        consoleBus.push('@q2=Pushing some test messages to go over this limit. Keep looking at free chars shown in the status as (+XXXX)')
        c:=1
        for x=1 to 19          //idzc=     old=>//zidxc=193 to 211
            tm='sample TRACE message = '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '
                                         +alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)
            consoleBus.push(tm)
            c+=1
        consoleBus.push('')   //idzc=     old=>//zidx=212
        consoleBus.push('!> Next 2 messages should make the buffer overflow. When this happens, an x sign will appear in status to show the dump took place, and we will lose some messages at the top <!')    //idzc=204   zc=244
        tm='sample TRACE message = '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '
                                     +alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)
        consoleBus.push(tm)   //idzc=     old=>//zidx=214
        c+=1
        tm:='sample TRACE message = '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '
                                     +alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)
        consoleBus.push(tm)
        consoleBus.push('')
        consoleBus.push('We lost some messages at the top to make way for new text. If need be whole of the Console will be cleared to make way for current message being logged')
        consoleBus.push('If the message is more than 4096 characters, TV would throw an error due to size limit and that message wouldnt come to the library at all')
        consoleBus.push('Test 26 completed ▲')
    
        consoleBus.push('Test 27 = Mark New Bars')        //idzc=230    zc=260
        consoleBus.push('@q2=This option adds a marker at start of each new bar')
        consoleBus.push('@q2=● on next bar call => console.MarkNewBar:=true ▼')
        for x=1 to 12                        
            consoleBus.push('@q2=Sample message = '+alphabetc.get((c-1)%26))
            c+=1
        consoleBus.push('Test 27 completed ▲')

        consoleBus.push('Test 28 = Change mininum Console width')     //idzc=237  zc=286
        consoleBus.push('@q2=Current minimum Console width is 80. We will be increasing this to 200 minimum')
        consoleBus.push('@q2=● on next bar call => console.MinWidth:=200 ▼')
        consoleBus.push('@q2=Console Width is now changed to atleast 200 characters wide.')
        consoleBus.push('@q2=Reset back to 80 at end of this test')
        consoleBus.push('Test 28 completed ▲')

        consoleBus.push('Test 29 = Convert Console to Logx')          //idzc=243  zc=292
        consoleBus.push('@q2=Now Console will be converted into a Logx. There is no need to create a new variable')
        consoleBus.push('@q2=● on next bar call => console.IsConsole:=false ▼')
        consoleBus.push(o_skiplog)
        consoleBus.push('Look this is a Logx now')
        consoleBus.push('Converting to a Logx wont make you lose any data')
        consoleBus.push('though converting back to Console will')     //idzc=249
        c:=1
        for x=1 to 3                       //idzc=250, 251, 252
            c+=1
            tm:='<Q1 message = '+alphabetc.get((c-1)%26)+'>'
            for y=2 to 6
                c+=1
                tm+='@q'+str.tostring(y)+'=<Q'+str.tostring(y)+' message = '+alphabetc.get((c-1)%26)+'>'
            consoleBus.push(tm)
        consoleBus.push('Now lets convert this back to Console')
        consoleBus.push('@q2=● on next bar call => console.IsConsole:=true ▼')
        consoleBus.push('Test 29 completed ▲')                        //idzc=255  zc=304

        consoleBus.push('Test 30 = Turning a page')     //idzc=256  zc=305
        consoleBus.push('@q2=All messages are logged on a "page", which could be turned at any point of time.')
        consoleBus.push('@q2=This is different from console.page which will flush all messages from previous bars')
        consoleBus.push('@q2=This is also different from PageOnEveryBar which will flush all messages from previous bars, based on Page History')
        consoleBus.push('@q2=turnPage will clear all older messages at the point turnPage is called, and is independent from above')
        c:=1
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))
        c+=1
        consoleBus.push('@q2=Error Code used = '+str.tostring(c)+'@q3=   Sample message = '+alphabetc.get((c-1)%26))

        consoleBus.push('@q2=● on next bar call => console.turnPage() ▼')
        consoleBus.push('@q2=All older messages have been cleared and we are on a new page (not dependent on PageOnEveryBar or console.page)')
        consoleBus.push('@q2=So, effectively, there are 3 ways to page messages')
        consoleBus.push('Test 30 completed ▲')      //idzc=267  zc=317

        // consoleBus.push('All Console Tests completed')                //idzc=294  zc=343

        consoleBus.push('Test 31 = Asynchronous Logging')     //zidc=268  zc=318
        consoleBus.push('@q2=Another way to log messages is to log them to each queue individually')
        consoleBus.push('@q2=This may be needed when you need to log messages at different times')
        consoleBus.push('@q2=Logging four sample messages to Q1 at one go, using console.alog(0,msg,1). These will be followed by logging to Q2 and Q3 separately, using console.alog(0,msg,2) and console.alog(0,msg,3) ')
        c:=1
        consoleBus.push('▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)      //zidc=272     zc=322
        c+=1
        consoleBus.push('▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    //zidc=273    zc=323
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q3=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    //zidc=280     zc=330
        c+=1
        consoleBus.push('@q3=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q3=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q3=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)   //zidc=284     zc=333
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)    
        c+=1
        consoleBus.push('@q2=▷ Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)      
        consoleBus.push('@q2=Some of the messages appeared to shift to left, because there was no data on left side.')
        consoleBus.push('@q2=This wont happen during Logx testing as cells are separate, whereas here they are not. This is not a bug, but expected behaviour')
        consoleBus.push('@q2=As soon as normal log method is used all queues are logged in sync')
        consoleBus.push('Test 31 completed ▲')     //zidc=293     zc=342

        consoleBus.push('Test 32 = Buffer overflow test using async logging')    //idzc=294   zc=343
        consoleBus.push('@q2=Test 32 = Buffer overflow test using async logging')    //idzc=295
        consoleBus.push('@q2='+tab4+'Pushing some test messages at one go, to over 4096 chars limit. Keep looking at free chars shown in the status as (+XXXX)')
        c:=1
        while c<=20                 //idzc=297 to 306    zc=346 to 365
            tm:='@q2='+tab4+'sample TRACE message #'+str.tostring(c)+'= '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '
                                         +alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)+', '+alphabet.get((c-1)%26)
            consoleBus.push(tm)
            c+=1
        consoleBus.push('@q2=')
        consoleBus.push('@q2='+tab4+'!> now some messages will be pushed to Q1 to check buffer over flow <!')   //idzc=296
        consoleBus.push('Did this cause buffer overflow?')   //idzc=297
        consoleBus.push('Did this cause buffer overflow?')   //idzc=298
        consoleBus.push('Only 86 characters to eat up')   //idzc=299
        consoleBus.push('Pushing some more data yet')   //idzc=300
        consoleBus.push('Only 32 characters to eat up')   //idzc=301
        consoleBus.push('!! Buffer Overflow !!')   //idzc=302
        consoleBus.push('We lost some messages at the top to make way for new text. If need be whole of the Console will be cleared to make way for current message being logged')
        consoleBus.push('Test 32 completed ▲')      //idzc=304   zc=

        consoleBus.push('Test 33 = Show Specific Log Level messages.')    //idzc=305   zc=
        consoleBus.push('Logging some sample messages with the Log Level 0 to 7')
        c:=1
        consoleBus.push(tab4+'Level 0'+tab4+'No Level'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)      //zidc=     zc=
        c+=1
        consoleBus.push(tab4+'Level 1'+tab4+'TRACE'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 2'+tab4+'DEBUG'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 3'+tab4+'INFO'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 4'+tab4+'WARNING'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 5'+tab4+'ERROR'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 6'+tab4+'CRITICAL'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        c+=1
        consoleBus.push(tab4+'Level 7'+tab4+'FATAL'+tab4+' Sample message = '+alphabetc.get((c-1)%26)+' ◁'+tab2)
        consoleBus.push('Setting sit.ShowMinimumLvel := 3 to display INFO or higher messages')
        consoleBus.push('Setting sit.ShowMinimumLvel := 4 to display WARNING or higher messages')
        consoleBus.push('Test 33 completed ▲')      //idzc=310   zc=

        consoleBus.push('Test 34 = Undo logged messages')    //idzc=311   zc=
        consoleBus.push('@q2=Pushing some sample messages')
        consoleBus.push('@q2=First message #15 will be removed, followed by removal of  #14, #13, #12 and finally all sample messages')
        c:=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        c+=1
        consoleBus.push('@q2=#'+str.tostring(c)+' Sample message = '+alphabetc.get((c-1)%26)+' ▼')
        consoleBus.push('@q2=All messages were removed')
        consoleBus.push('@q2=Undo will remove messages logged via logx.log and stop as soon as it finds asynchronously logged messages')
        consoleBus.push('Test 34 completed ▲')      //idzc=320   zc=

        consoleBus.push('All Console Tests completed')                //idzc=321  zc=
        
        // _________________________________________________________________________Console Testing ends on idzc=305


    if fillData and not _filled
        //______ == ______________________________ attachment Testing starts on idza=1
        consoleBus.push('Attachment Test 1 = Attaching a Console to Logx')                 //idza=1
        consoleBus.push( o_skiplog)
        consoleBus.push( o_skiplog)
        consoleBus.push('Console ready for attachment testing with Logx')
        consoleBus.push('.....still waiting ◯')      
        consoleBus.push('..»▷ ATTACHED to Logx! ◁«..')                          //idza=6
        consoleBus.push( o_skiplog)
        consoleBus.push( o_skiplog)
        consoleBus.push( o_skiplog)
        consoleBus.push( o_skiplog)
        consoleBus.push('waiting to be moved to the left')
        consoleBus.push('.. still waiting ◯')                           //idza=12
        consoleBus.push('@q2=Console is now on left of Logx')
        consoleBus.push('@q3=Waiting for Status Bar to be moved to the top')
        consoleBus.push('Status Bar moved to the top')                           //idza=15
        consoleBus.push('@q2=Console is now on top of Logx')
        consoleBus.push('')
        consoleBus.push('waiting to be moved to the right of Logx')   //idza=18
        consoleBus.push('@q2=Console is now at right of Logx')
        consoleBus.push('')
        consoleBus.push('Preparing to move the Status Bar')           //idza=21
        consoleBus.push('Status Bar is at top now')
        consoleBus.push('At default location = Bottom of Logx')
        consoleBus.push('')
        consoleBus.push('Waiting to be detached')                     //idza=25
        consoleBus.push('◁«.. DETACHED from Logx ..»▷')
        consoleBus.push('Attachment Test 1 completed ▲')
        consoleBus.push('Attachment testing is completed now !!')
        //______ xx ______________________________ attachment Testing ends on idza=28


        
        var int commonBusSize = int(str.tonumber(dbus.get(0,0)))
        
        for zc=0 to consoleBus.size() -1
            gc:=consoleBus.get(zc)
            dbus.set(zc,1,gc)

            if str.contains(gc,'Test') and str.contains(gc,'=') and not str.contains(gc,'@q')
                gs:=gc
            if str.contains(gc,'Test') and str.contains(gc,'completed')
                gs:=''

            q2pos=str.pos(gc,'@q2=')
            q3pos=str.pos(gc,'@q3=')
            q4pos=str.pos(gc,'@q4=')
            q5pos=str.pos(gc,'@q5=')
            q6pos=str.pos(gc,'@q6=')
            end=str.length(gc)
            gm1:= str.substring(gc,0,na(q2pos)?na(q3pos)?na(q4pos)?na(q5pos)?na(q6pos)?end:q6pos:q5pos:q4pos:q3pos:q2pos)
            gm2:= na(q2pos) ? '' : str.substring(gc,q2pos+4,na(q3pos)?na(q4pos)?na(q5pos)?na(q6pos)?end:q6pos:q5pos:q4pos:q3pos)
            gm3:= na(q3pos) ? '' : str.substring(gc,q3pos+4,na(q4pos)?na(q5pos)?na(q6pos)?end:q6pos:q5pos:q4pos)
            gm4:= na(q4pos) ? '' : str.substring(gc,q4pos+4,na(q5pos)?na(q6pos)?end:q6pos:q5pos)
            gm5:= na(q5pos) ? '' : str.substring(gc,q5pos+4,na(q6pos)?end:q6pos)
            gm6:= na(q6pos) ? '' : str.substring(gc,q6pos+4,end)

            gm:=gm1+(gm2==''?'':(tab4+gm2))+(gm3==''?'':(tab4+gm3))+(gm4==''?'':(tab4+gm4))+(gm5==''?'':(tab4+gm5))+(gm6==''?'':(tab4+gm6))
            if (zc>=299 and zc<=301) or (zc>=321 and zc<=343) or (zc>=348 and zc<=371)
                dbus.set(zc, devcolm1, str.replace_all(gm1,'logx.','sit.'))
                dbus.set(zc, devcolm2, str.replace_all(gm2,'logx.','sit.'))
                dbus.set(zc, devcolm3, str.replace_all(gm3,'logx.','sit.'))
                dbus.set(zc, devcolm4, str.replace_all(gm4,'logx.','sit.'))
                dbus.set(zc, devcolm5, str.replace_all(gm5,'logx.','sit.'))
                dbus.set(zc, devcolm6, str.replace_all(gm6,'logx.','sit.'))
                dbus.set(zc, prodcolm1, str.replace_all(gm1,'logx.','demo.'))
                dbus.set(zc, prodcolm2, str.replace_all(gm2,'logx.','demo.'))
                dbus.set(zc, prodcolm3, str.replace_all(gm3,'logx.','demo.'))
                dbus.set(zc, prodcolm4, str.replace_all(gm4,'logx.','demo.'))
                dbus.set(zc, prodcolm5, str.replace_all(gm5,'logx.','demo.'))
                dbus.set(zc, prodcolm6, str.replace_all(gm6,'logx.','demo.'))
                dbus.set(zc, devcollevelL,'zc='+ str.tostring(zc))
                dbus.set(zc, prodcollevelL,'zc='+ str.tostring(zc))

            dbus.set(zc, devcolmsg, str.replace_all(gm,'console.','sit.'))
            dbus.set(zc, prodcolmsg, str.replace_all(gm,'console.','demo.'))
            dbus.set(zc, devcolstatusC,'<SIT zc = ' + str.tostring(zc)+' ▶ '+gs+'>')
            dbus.set(zc, prodcolstatusC,gs)
            dbus.set(zc, devcollevelC,'zc='+ str.tostring(zc))
            dbus.set(zc, prodcollevelC,'zc='+ str.tostring(zc))
        for x=consoleBus.size() to dbus.rows()-1
            dbus.set(x, devcolmsg,'Console testing has been completed #'+str.tostring(x))
            dbus.set(x, prodcolmsg,'Console testing has been completed #'+str.tostring(x))

        _filled:=true
    consoleBus.clear()

//	td4	dev.110
