Platforms to show: All Mac Windows Linux Cross-Platform
/Util/Memory String functions tests
Required plugins for this example: MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Util/Memory String functions tests
This example is the version from Sun, 17th Mar 2012.
Project "Memory String functions tests.xojo_binary_project"
Class Window1 Inherits Window
EventHandler Sub Open()
dim m,n as MemoryBlock
m=StringToMemoryBlockMBS("Hallo")
n=m.LeftMBS(50)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 1 failed"
end if
n=m.LeftMBS(5)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 2 failed"
end if
n=m.LeftMBS(3)
if "Hal"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 3 failed"
end if
n=m.LeftMBS(0)
if n<>nil then
MsgBox "Test 4 failed"
end if
n=m.RightMBS(50)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 5 failed"
end if
n=m.RightMBS(5)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 6 failed"
end if
n=m.RightMBS(3)
if "llo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 7 failed"
end if
n=m.RightMBS(0)
if n<>nil then
MsgBox "Test 8 failed"
end if
n=m.MidMBS(0,50)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 9 failed"
end if
n=m.MidMBS(0,5)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 10 failed"
end if
n=m.MidMBS(0,3)
if "Hal"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 11 failed"
end if
n=m.MidMBS(0,0)
if n<>nil then
MsgBox "Test 12 failed"
end if
n=m.MidMBS(0,5)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 13 failed"
end if
n=m.MidMBS(5,0)
if n<>nil then
MsgBox "Test 14 failed"
end if
n=m.MidMBS(0,8)
if "Hallo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 15 failed"
end if
n=m.MidMBS(8,0)
if n<>nil then
MsgBox "Test 16 failed"
end if
n=m.MidMBS(2,2)
if "ll"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 17 failed"
end if
n=m.MidMBS(2,4)
if "llo"<>MemoryBlockToStringMBS(n) then
MsgBox "Test 18 failed"
end if
End EventHandler
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Util Plugin.