home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmBitVectorTest
- Caption = "BitVector Class Test"
- ClientHeight = 4455
- ClientLeft = 1245
- ClientTop = 1635
- ClientWidth = 5715
- Height = 4890
- Left = 1170
- LinkTopic = "Form1"
- ScaleHeight = 297
- ScaleMode = 3 'Pixel
- ScaleWidth = 381
- Top = 1275
- Width = 5865
- Begin VB.CommandButton cmdtest4
- Caption = "Test &4"
- Height = 405
- Left = 4290
- TabIndex = 3
- Top = 1650
- Width = 1215
- End
- Begin VB.Timer Timer1
- Interval = 55
- Left = 5040
- Top = 2250
- End
- Begin VB.CommandButton cmdTest3
- Caption = "Test &3"
- Height = 405
- Left = 4290
- TabIndex = 2
- Top = 1170
- Width = 1215
- End
- Begin VB.CommandButton cmdTest2
- Caption = "Test &2"
- Height = 405
- Left = 4290
- TabIndex = 1
- Top = 690
- Width = 1215
- End
- Begin VB.CommandButton cmdTest1
- Caption = "Test &1"
- Height = 405
- Left = 4290
- TabIndex = 0
- Top = 210
- Width = 1215
- End
- Begin VB.Image Image1
- Height = 180
- Index = 1
- Left = 4710
- Picture = "BITVECTR.frx":0000
- Top = 2370
- Visible = 0 'False
- Width = 180
- End
- Begin VB.Image Image1
- Height = 180
- Index = 0
- Left = 4470
- Picture = "BITVECTR.frx":00E2
- Top = 2370
- Visible = 0 'False
- Width = 180
- End
- Attribute VB_Name = "frmBitVectorTest"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- ' BitVector Class Test App
- ' Copyright
- 1995-1996 by Gregg S. Irwin. All Rights Reserved.
- DefInt A-Z
- Dim mTestMode As Integer
- Dim BV As New BitVector
- Private Sub cmdTest1_Click()
- mTestMode = 1
- Cls
- BV.NumElements = 25000
- BV.SetBit 12345
- Print BV.IsBitSet(12345)
- BV.ClearBit 12345
- Print BV.IsBitSet(12345)
- BV.ToggleBit 12345
- Print BV.IsBitSet(12345)
- BV.ToggleBit 12345
- Print BV.IsBitSet(12345)
- On Error GoTo Test1Err
- BV.ToggleBit 25001
- On Error GoTo 0
- Test1Exit:
- Exit Sub
- Test1Err:
- Print Err.Description, Err.Source
- Resume Next
- End Sub
- Private Sub cmdTest2_Click()
- mTestMode = 2
- Cls
- BV.NumElements = 4096
- End Sub
- Private Sub cmdTest3_Click()
- mTestMode = 3
- Cls
- BV.NumElements = 256
- End Sub
- Private Sub cmdtest4_Click()
- mTestMode = 4
- Cls
- Print "Bit Property Access"
- BV.NumElements = 256
- Print "Bit 1:", BV.Bit(1)
- Print "Setting Bit 1"
- BV.Bit(1) = 1
- Print "Bit 1:", BV.Bit(1)
- On Error Resume Next
- Print "NumElements error handler test"
- BV.NumElements = -1
- If Err Then
- Print Err.Description, Err.Source
- End If
-
- BV.NumElements = 0
- Print "Setting NumElements to 0"
- Print "Accessing Bit 0: (should cause error)"
- Print BV.Bit(0)
- If Err Then
- Print Err.Description, Err.Source
- End If
- On Error GoTo 0
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Dim Row As Integer
- Dim Col As Integer
- Dim Index As Long
- If mTestMode = 2 Then
- Row = X \ 12
- Col = Y \ 12
- Index = Row * Col
- BV.ToggleBit Index
- PaintPicture Image1(BV.GetBit(Index)).Picture, Row * 12, Col * 12
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
-
- Set BV = Nothing
- End Sub
- Private Sub Timer1_Timer()
- Dim Index As Long
- If mTestMode = 3 Then
- Index = CLng(Rnd * (BV.NumElements - 1))
- BV.ToggleBit Index
- PaintPicture Image1(BV.GetBit(Index)).Picture, (Index \ 16) * 12, (Index Mod 16) * 12
- End If
- End Sub
-