Added docs and project management tool update
This commit is contained in:
50
unit_test/media/map-20kdm2.txt
Normal file
50
unit_test/media/map-20kdm2.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
-=( Map Information )=- -----------------------------------------------
|
||||
|
||||
<Title> : Return to Castle: Quake
|
||||
<Date> : 02/02/02 - ren 11/17/2002
|
||||
<Filename> : map-20kdm2.pk3
|
||||
<Author> : Michael "<|3FG20K>" Cook
|
||||
<Email Address> : bfg20k@nycap.rr.com / bfg20k@planetquake.com
|
||||
<Website> : http://www.planetquake.com/bfg20k
|
||||
<Description> : This is an Evil7 Castle! It has three tiers,
|
||||
tight spaces, and plenty of room for various
|
||||
battles.
|
||||
|
||||
<Additional Credits> : [HFX]Evil, for making great textures.
|
||||
|
||||
-=( Construction )=- --------------------------------------------------
|
||||
|
||||
<Base> : None.
|
||||
<Editor(s) Used> : Q3Radiant - Build 202 & Q3Build
|
||||
<Known Bugs> : This isn't really a bug, but an added feature;
|
||||
you can walk on top of the battlements.
|
||||
<Construction Time> : 3 weeks.
|
||||
<Compile Machine> : 866mhz PIII, 512mb RAM
|
||||
|
||||
-=( Play Information )=- ----------------------------------------------
|
||||
|
||||
<Mod> : A good one.
|
||||
<Players> : 2-8 Players
|
||||
<Bots> : Duh! wait, I THINK they're smarter than Forrest
|
||||
Gump... You'll have to clarify that for me =).
|
||||
|
||||
-={ Installation }=- --------------------------------------------------
|
||||
|
||||
<Installation> : Unzip the the zip file map-20kdm2.zip into
|
||||
your "Quake III Arena\baseq3" directory
|
||||
Run Quake III Arena, and under console type
|
||||
"/map 20kdm2" or select under Skirmish in
|
||||
SIngle Player mode.
|
||||
|
||||
-=( Copyright / Permissions )=- ---------------------------------------
|
||||
|
||||
<Copyright> : You not include or distribute this map in any
|
||||
sort of commercial product without permission
|
||||
from the author. You may not mass distribute
|
||||
this level via any non-electronic means
|
||||
including but not limited to compact disks,
|
||||
and floppy disks without permission from the
|
||||
author.
|
||||
|
||||
-=( This is the End )=- -----------------------------------------------
|
||||
317
unit_test/test.bas
Normal file
317
unit_test/test.bas
Normal file
@@ -0,0 +1,317 @@
|
||||
Sub cat( cat_name$ )
|
||||
Print""
|
||||
Print "---------------------["; UCase$(cat_name$); " Test]---------------------"
|
||||
End Sub
|
||||
|
||||
|
||||
cat("Console I/O")
|
||||
|
||||
FPrint("Single Line")
|
||||
FPrint("Two\nLines")
|
||||
Print ""
|
||||
user_input$ = Input$("Enter Something: ")
|
||||
Print ""
|
||||
Print "You type: "; user_input$
|
||||
|
||||
|
||||
cat("Arrays")
|
||||
Dim num_array1D[7]
|
||||
Dim str_array1D$[11]
|
||||
Dim usr_array1D[22] As Empty
|
||||
|
||||
Dim num_array2D[4, 6]
|
||||
Dim str_array2D$[3, 9]
|
||||
Dim usr_array2D[2,5] As Empty
|
||||
|
||||
Dim num_array3D[13,11,6]
|
||||
Dim str_array3D[11,22,7]
|
||||
Dim usr_array3D[12,5,14] As Empty
|
||||
|
||||
Print "*** ArrayDim() Test ***"
|
||||
Print ""
|
||||
|
||||
Print "num_array1D[] dimensions: expected=1, returned="; ArrayDim(num_array1D)
|
||||
Print "str_array1D[] dimensions: expected=1, returned="; ArrayDim(str_array1D)
|
||||
Print "usr_array1D[] dimensions: expected=1, returned="; ArrayDim(usr_array1D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array2D[] dimensions: expected=2, returned="; ArrayDim(num_array2D)
|
||||
Print "str_array2D[] dimensions: expected=2, returned="; ArrayDim(str_array2D)
|
||||
Print "usr_array2D[] dimensions: expected=2, returned="; ArrayDim(usr_array2D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array3D[] dimensions: expected=3, returned="; ArrayDim(num_array3D)
|
||||
Print "str_array3D[] dimensions: expected=3, returned="; ArrayDim(str_array3D)
|
||||
Print "usr_array3D[] dimensions: expected=3, returned="; ArrayDim(usr_array3D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "*** ArraySize() Test ***"
|
||||
Print ""
|
||||
|
||||
Print "num_array1D[] Size: expected=7,0,0, returned="; ArraySize(num_array1D,1); ","; ArraySize(num_array1D,2); ","; ArraySize(num_array1D,3)
|
||||
Print "str_array1D[] Size: expected=11,0,0, returned="; ArraySize(str_array1D,1); ","; ArraySize(str_array1D,2); ","; ArraySize(str_array1D,3)
|
||||
Print "usr_array1D[] Size: expected=22,0,0, returned="; ArraySize(usr_array1D,1); ","; ArraySize(usr_array1D,2); ","; ArraySize(usr_array1D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array2D[] Size: expected=4,6,0, returned="; ArraySize(num_array2D,1); ","; ArraySize(num_array2D,2); ","; ArraySize(num_array2D,3)
|
||||
Print "str_array2D[] Size: expected=3,9,0, returned="; ArraySize(str_array2D,1); ","; ArraySize(str_array2D,2); ","; ArraySize(str_array2D,3)
|
||||
Print "usr_array2D[] Size: expected=2,5,0, returned="; ArraySize(usr_array2D,1); ","; ArraySize(usr_array2D,2); ","; ArraySize(usr_array2D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array3D[] Size: expected=13,11,6, returned="; ArraySize(num_array3D,1); ","; ArraySize(num_array3D,2); ","; ArraySize(num_array3D,3)
|
||||
Print "str_array3D[] Size: expected=11,22,7, returned="; ArraySize(str_array3D,1); ","; ArraySize(str_array3D,2); ","; ArraySize(str_array3D,3)
|
||||
Print "usr_array3D[] Size: expected=12,5,14, returned="; ArraySize(usr_array3D,1); ","; ArraySize(usr_array3D,2); ","; ArraySize(usr_array3D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "*** ArrayCopy() Test ***"
|
||||
Print ""
|
||||
|
||||
Dim num_array_copy1D_smaller[3]
|
||||
Dim num_array_copy1D_bigger[21]
|
||||
|
||||
Dim str_array_copy1D_smaller$[3]
|
||||
Dim str_array_copy1D_bigger$[21]
|
||||
|
||||
num_array1D[0] = -4
|
||||
num_array1D[1] = 12
|
||||
num_array1D[2] = 9
|
||||
num_array1D[6] = 99
|
||||
|
||||
str_array1D$[0] = "zero"
|
||||
str_array1D$[4] = "FoUr"
|
||||
str_array1D$[9] = "NINE"
|
||||
str_array1D$[10] = "ten"
|
||||
|
||||
Type Test_Type1
|
||||
Dim x[5]
|
||||
Dim y[7,5]
|
||||
Dim txt_var1$
|
||||
Dim txt_var2$[14]
|
||||
End Type
|
||||
|
||||
Type Test_Type2
|
||||
Dim t2_var1[7,5] As Test_Type1
|
||||
Dim v1[25]
|
||||
Dim txt_var1$
|
||||
End Type
|
||||
|
||||
Type Test_Type3
|
||||
Dim tst_t[7,5,9] As Test_Type2
|
||||
Dim tst_t2 As Test_Type2
|
||||
Dim x, y[6,5], z[21]
|
||||
Dim txt_var1$[8,7]
|
||||
End Type
|
||||
|
||||
Dim type_array[10] As Test_Type3
|
||||
Dim type_array_copy_smaller[3]
|
||||
Dim type_array_copy_bigger[19]
|
||||
|
||||
type_array[0].tst_t[3,4,7].t2_var1[5,3].txt_var2$[7] = "test type array Case One"
|
||||
type_array[0].tst_t[3,4,7].t2_var1[5,3].y[4,2] = 42
|
||||
type_array[9].tst_t[6,4,8].t2_var1[5,3].txt_var2$[7] = "test type array Case Two"
|
||||
type_array[0].tst_t[3,4,7].v1[4] = 29.54
|
||||
type_array[9].txt_var1$[5,6] = "test type array Case Three"
|
||||
|
||||
ArrayCopy(num_array1D, num_array_copy1D_smaller)
|
||||
ArrayCopy(num_array1D, num_array_copy1D_bigger)
|
||||
|
||||
ArrayCopy(str_array1D, str_array_copy1D_smaller)
|
||||
ArrayCopy(str_array1D, str_array_copy1D_bigger)
|
||||
|
||||
Print "test type"
|
||||
ArrayCopy(type_array, type_array_copy_smaller)
|
||||
Print "Not Dead yet"
|
||||
ArrayCopy(type_array, type_array_copy_bigger)
|
||||
|
||||
Print "num_array1D[] Size: expected=7,0,0, returned="; ArraySize(num_array1D,1); ","; ArraySize(num_array1D,2); ","; ArraySize(num_array1D,3)
|
||||
Print "str_array1D[] Size: expected=11,0,0, returned="; ArraySize(str_array1D,1); ","; ArraySize(str_array1D,2); ","; ArraySize(str_array1D,3)
|
||||
Print "usr_array1D[] Size: expected=22,0,0, returned="; ArraySize(usr_array1D,1); ","; ArraySize(usr_array1D,2); ","; ArraySize(usr_array1D,3)
|
||||
|
||||
|
||||
|
||||
'Testing User Types
|
||||
Type TestType1
|
||||
Dim x, y[5]
|
||||
Dim txt$[7]
|
||||
Dim t2$
|
||||
End Type
|
||||
|
||||
Type TestType2
|
||||
Dim a
|
||||
Dim b[12] As TestType1
|
||||
Dim c As TestType1
|
||||
End Type
|
||||
|
||||
Type TestType3
|
||||
Dim r[6] As TestType2
|
||||
Dim c As TestType1
|
||||
End Type
|
||||
|
||||
|
||||
Dim v[20] As TestType3
|
||||
|
||||
v[4].r[2].b[11].txt$[4] = "hello"
|
||||
|
||||
Print "Testing User Defined Types"
|
||||
Print "------------------------------"
|
||||
For i = 0 to ArraySize(v[4].r[2].b[11].txt$, 1)-1
|
||||
Print "txt["; i; "] = "; v[4].r[2].b[11].txt$[i]
|
||||
Next
|
||||
|
||||
|
||||
Print ""
|
||||
Print "Testing Graphics and Physics"
|
||||
'Testing Graphics
|
||||
OpenWindow("Test Window", 640, 480, 0, 0)
|
||||
|
||||
Dim w, h
|
||||
|
||||
GetWindowSize(w, h)
|
||||
|
||||
Print "Win Size = "; w;", "; h
|
||||
|
||||
canvas1 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
|
||||
canvas2 = OpenCanvas(640, 480, 0, 0, 640, 480, 0)
|
||||
|
||||
SetCanvasZ(canvas2, 0)
|
||||
|
||||
SetCanvas3D(canvas1, true)
|
||||
|
||||
fnt$ = "NotoSansJP-VariableFont_wght.ttf"
|
||||
hud_font = loadFont(fnt, 12)
|
||||
|
||||
Canvas(canvas2)
|
||||
|
||||
SetColor(RGB(255,255,255))
|
||||
Dim hud_txt$[9]
|
||||
hud_txt$[0] = "W/A/S/D Keys to Move"
|
||||
hud_txt$[1] = "R/F Keys to Move Up/Down"
|
||||
hud_txt$[2] = "Arrow Keys to Rotate Camera"
|
||||
hud_txt$[3] = "Z Key to Rotate Character"
|
||||
hud_txt$[4] = "X Key to Move Character Forward"
|
||||
hud_txt$[5] = "C Key to Move Character Up"
|
||||
|
||||
For i = 0 to 5
|
||||
DrawText(hud_txt$[i], 10, 10+(i*15))
|
||||
Next
|
||||
|
||||
Canvas(canvas1)
|
||||
|
||||
mesh1 = LoadMesh("media/sydney.md2")
|
||||
|
||||
actor1 = CreateMeshActor(mesh1)
|
||||
actor1_texture = LoadImage("media/sydney.bmp")
|
||||
mat = CreateMaterial()
|
||||
SetMaterialTexture(mat, 0, actor1_texture)
|
||||
SetMaterialLighting(mat, false)
|
||||
SetActorMaterial(actor1, 0, mat)
|
||||
|
||||
a_mat = GetActorMaterial(actor1, 0)
|
||||
SetMaterialLighting(a_mat, false)
|
||||
|
||||
SetActorSolid(actor1, true)
|
||||
SetActorCollisionShape(actor1, 4, 25)
|
||||
TranslateActor(actor1, 0, 150, 0)
|
||||
|
||||
|
||||
level = LoadMeshFromArchive("media/map-20kdm2.pk3", "20kdm2.bsp")
|
||||
actor2 = CreateMeshOctreeActor(level)
|
||||
SetActorSolid(actor2, true)
|
||||
SetActorCollisionShape(actor2, 7, 0)
|
||||
|
||||
|
||||
Dim ax, ay, az
|
||||
|
||||
Canvas(canvas1)
|
||||
SetActorPosition(actor1, 1160, 399, 2122)
|
||||
SetActorRotation(actor1, 0, 0, 0)
|
||||
|
||||
SetCameraPosition(984, 488, 2303)
|
||||
SetCameraRotation(23, 1216, 0)
|
||||
|
||||
init = true
|
||||
i = 0
|
||||
|
||||
Dim vx, vy, vz
|
||||
mass = 8
|
||||
GetActorLocalInertia(actor1, vx, vy, vz)
|
||||
SetActorMassProperties(actor1, mass, vx, vy, vz)
|
||||
SetActorGravity(actor1, 0, -100, 0)
|
||||
|
||||
While Not Key(K_ESCAPE)
|
||||
|
||||
SetActorAngularVelocityWorld(actor1, 0, 0, 0)
|
||||
|
||||
If Key(K_W) Then
|
||||
Canvas(canvas1)
|
||||
TranslateCamera(0,0,10)
|
||||
ElseIf Key(K_S) Then
|
||||
Canvas(canvas1)
|
||||
TranslateCamera(0,0,-10)
|
||||
End If
|
||||
|
||||
If Key(K_A) Then
|
||||
Canvas(canvas1)
|
||||
TranslateCamera(-10,0,0)
|
||||
ElseIf Key(K_D) Then
|
||||
Canvas(canvas1)
|
||||
TranslateCamera(10,0,0)
|
||||
End If
|
||||
|
||||
If Key(K_R) Then
|
||||
Canvas(canvas1)
|
||||
Dim crx, cry, crz
|
||||
GetCameraPosition(crx, cry, crz)
|
||||
SetCameraPosition(crx, cry+10, crz)
|
||||
ElseIf Key(K_F) Then
|
||||
Canvas(canvas1)
|
||||
'TranslateCameraW(0, -10, 0) - Haven't added this function yet
|
||||
Dim crx, cry, crz
|
||||
GetCameraPosition(crx, cry, crz)
|
||||
SetCameraPosition(crx, cry-10, crz)
|
||||
End If
|
||||
|
||||
|
||||
If Key(K_UP) Then
|
||||
Canvas(canvas1)
|
||||
RotateCamera(1, 0, 0)
|
||||
ElseIf Key(K_DOWN) Then
|
||||
Canvas(canvas1)
|
||||
RotateCamera(-1, 0, 0)
|
||||
End If
|
||||
|
||||
If Key(K_LEFT) Then
|
||||
Canvas(canvas1)
|
||||
Dim crx, cry, crz
|
||||
GetCameraRotation(crx, cry, crz)
|
||||
|
||||
RotateCamera(-1*crx, 0, 0)
|
||||
RotateCamera(0, -1, 0)
|
||||
RotateCamera(crx, 0, 0)
|
||||
ElseIf Key(K_RIGHT) Then
|
||||
Canvas(canvas1)
|
||||
Dim crx, cry, crz
|
||||
GetCameraRotation(crx, cry, crz)
|
||||
SetCameraRotation(crx, cry+1, crz)
|
||||
End If
|
||||
|
||||
If Key(K_Z) Then
|
||||
SetActorAngularVelocityLocal(actor1, 0, 10, 0)
|
||||
End If
|
||||
|
||||
If Key(K_X) Then
|
||||
SetActorLinearVelocityLocal(actor1, 60, 0, 0)
|
||||
End If
|
||||
|
||||
If Key(K_C) Then
|
||||
SetActorLinearVelocityLocal(actor1, 0, 60, 0)
|
||||
End If
|
||||
|
||||
Update()
|
||||
Wend
|
||||
154
unit_test/unittest_arrays.bas
Normal file
154
unit_test/unittest_arrays.bas
Normal file
@@ -0,0 +1,154 @@
|
||||
Include "unittest_lib.bas"
|
||||
|
||||
cat("Arrays")
|
||||
Dim num_array1D[7]
|
||||
Dim str_array1D$[11]
|
||||
Dim usr_array1D[22] As Empty
|
||||
|
||||
Dim num_array2D[4, 6]
|
||||
Dim str_array2D$[3, 9]
|
||||
Dim usr_array2D[2,5] As Empty
|
||||
|
||||
Dim num_array3D[13,11,6]
|
||||
Dim str_array3D[11,22,7]
|
||||
Dim usr_array3D[12,5,14] As Empty
|
||||
|
||||
Print "*** ArrayDim() Test ***"
|
||||
Print ""
|
||||
|
||||
Print "num_array1D[] dimensions: expected=1, returned="; ArrayDim(num_array1D)
|
||||
Print "str_array1D[] dimensions: expected=1, returned="; ArrayDim(str_array1D)
|
||||
Print "usr_array1D[] dimensions: expected=1, returned="; ArrayDim(usr_array1D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array2D[] dimensions: expected=2, returned="; ArrayDim(num_array2D)
|
||||
Print "str_array2D[] dimensions: expected=2, returned="; ArrayDim(str_array2D)
|
||||
Print "usr_array2D[] dimensions: expected=2, returned="; ArrayDim(usr_array2D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array3D[] dimensions: expected=3, returned="; ArrayDim(num_array3D)
|
||||
Print "str_array3D[] dimensions: expected=3, returned="; ArrayDim(str_array3D)
|
||||
Print "usr_array3D[] dimensions: expected=3, returned="; ArrayDim(usr_array3D)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "*** ArraySize() Test ***"
|
||||
Print ""
|
||||
|
||||
Print "num_array1D[] Size: expected=7,0,0, returned="; ArraySize(num_array1D,1); ","; ArraySize(num_array1D,2); ","; ArraySize(num_array1D,3)
|
||||
Print "str_array1D[] Size: expected=11,0,0, returned="; ArraySize(str_array1D,1); ","; ArraySize(str_array1D,2); ","; ArraySize(str_array1D,3)
|
||||
Print "usr_array1D[] Size: expected=22,0,0, returned="; ArraySize(usr_array1D,1); ","; ArraySize(usr_array1D,2); ","; ArraySize(usr_array1D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array2D[] Size: expected=4,6,0, returned="; ArraySize(num_array2D,1); ","; ArraySize(num_array2D,2); ","; ArraySize(num_array2D,3)
|
||||
Print "str_array2D[] Size: expected=3,9,0, returned="; ArraySize(str_array2D,1); ","; ArraySize(str_array2D,2); ","; ArraySize(str_array2D,3)
|
||||
Print "usr_array2D[] Size: expected=2,5,0, returned="; ArraySize(usr_array2D,1); ","; ArraySize(usr_array2D,2); ","; ArraySize(usr_array2D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "num_array3D[] Size: expected=13,11,6, returned="; ArraySize(num_array3D,1); ","; ArraySize(num_array3D,2); ","; ArraySize(num_array3D,3)
|
||||
Print "str_array3D[] Size: expected=11,22,7, returned="; ArraySize(str_array3D,1); ","; ArraySize(str_array3D,2); ","; ArraySize(str_array3D,3)
|
||||
Print "usr_array3D[] Size: expected=12,5,14, returned="; ArraySize(usr_array3D,1); ","; ArraySize(usr_array3D,2); ","; ArraySize(usr_array3D,3)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "*** ArrayCopy() Test ***"
|
||||
Print ""
|
||||
|
||||
Dim num_array_copy1D_smaller[3]
|
||||
Dim num_array_copy1D_bigger[21]
|
||||
|
||||
Dim str_array_copy1D_smaller$[3]
|
||||
Dim str_array_copy1D_bigger$[21]
|
||||
|
||||
num_array1D[0] = -4
|
||||
num_array1D[1] = 12
|
||||
num_array1D[2] = 9
|
||||
num_array1D[6] = 99
|
||||
|
||||
str_array1D$[0] = "zero"
|
||||
str_array1D$[4] = "FoUr"
|
||||
str_array1D$[9] = "NINE"
|
||||
str_array1D$[10] = "ten"
|
||||
|
||||
Type Test_Type1
|
||||
Dim x[5]
|
||||
Dim y[7,5]
|
||||
Dim txt_var1$
|
||||
Dim txt_var2$[14]
|
||||
End Type
|
||||
|
||||
Type Test_Type2
|
||||
Dim t2_var1[7,5] As Test_Type1
|
||||
Dim v1[25]
|
||||
Dim txt_var1$
|
||||
End Type
|
||||
|
||||
Type Test_Type3
|
||||
Dim tst_t[7,5,9] As Test_Type2
|
||||
Dim tst_t2 As Test_Type2
|
||||
Dim x, y[6,5], z[21]
|
||||
Dim txt_var1$[8,7]
|
||||
End Type
|
||||
|
||||
Dim type_array[10] As Test_Type3
|
||||
Dim type_array_copy1D_smaller[3] As Test_Type3
|
||||
Dim type_array_copy1D_bigger[19] As Test_Type3
|
||||
|
||||
type_array[0].tst_t[3,4,7].t2_var1[5,3].txt_var2$[7] = "test type array Case One"
|
||||
type_array[0].tst_t[3,4,7].t2_var1[5,3].y[4,2] = 42
|
||||
type_array[9].tst_t[6,4,8].t2_var1[5,3].txt_var2$[7] = "test type array Case Two"
|
||||
type_array[0].tst_t[3,4,7].v1[4] = 29.54
|
||||
type_array[9].txt_var1$[5,6] = "test type array Case Three"
|
||||
|
||||
ArrayCopy(num_array1D, num_array_copy1D_smaller)
|
||||
ArrayCopy(num_array1D, num_array_copy1D_bigger)
|
||||
|
||||
ArrayCopy(str_array1D, str_array_copy1D_smaller)
|
||||
ArrayCopy(str_array1D, str_array_copy1D_bigger)
|
||||
|
||||
ArrayCopy(type_array, type_array_copy1D_smaller)
|
||||
ArrayCopy(type_array, type_array_copy1D_bigger)
|
||||
|
||||
Print "num_array_copy1D_smaller[] Size: expected=7,0,0, returned="; ArraySize(num_array_copy1D_smaller,1); ","; ArraySize(num_array_copy1D_smaller,2); ","; ArraySize(num_array_copy1D_smaller,3)
|
||||
Print "num_array_copy1D_smaller[0] Value: expected=-4, returned="; num_array_copy1D_smaller[0]
|
||||
Print "num_array_copy1D_smaller[1] Value: expected=12, returned="; num_array_copy1D_smaller[1]
|
||||
Print "num_array_copy1D_smaller[6] Value: expected=99, returned="; num_array_copy1D_smaller[6]
|
||||
Print ""
|
||||
Print "num_array_copy1D_bigger[] Size: expected=7,0,0, returned="; ArraySize(num_array_copy1D_bigger,1); ","; ArraySize(num_array_copy1D_bigger,2); ","; ArraySize(num_array_copy1D_bigger,3)
|
||||
Print "num_array_copy1D_bigger[0] Value: expected=-4, returned="; num_array_copy1D_bigger[0]
|
||||
Print "num_array_copy1D_bigger[1] Value: expected=12, returned="; num_array_copy1D_bigger[1]
|
||||
Print "num_array_copy1D_bigger[6] Value: expected=99, returned="; num_array_copy1D_bigger[6]
|
||||
Print ""
|
||||
Print dash_line$
|
||||
Print ""
|
||||
|
||||
Print "str_array_copy1D_smaller[] Size: expected=11,0,0, returned="; ArraySize(str_array_copy1D_smaller,1); ","; ArraySize(str_array_copy1D_smaller,2); ","; ArraySize(str_array_copy1D_smaller,3)
|
||||
Print "str_array_copy1D_smaller[0] Value: expected=\qzero\q, returned=\q"; str_array_copy1D_smaller[0];"\q"
|
||||
Print "str_array_copy1D_smaller[4] Value: expected=\qFoUr\q, returned=\q"; str_array_copy1D_smaller[4];"\q"
|
||||
Print "str_array_copy1D_smaller[10] Value: expected=\qten\q, returned=\q"; str_array_copy1D_smaller[10];"\q"
|
||||
Print ""
|
||||
Print "str_array_copy1D_bigger[] Size: expected=11,0,0, returned="; ArraySize(str_array_copy1D_bigger,1); ","; ArraySize(str_array_copy1D_bigger,2); ","; ArraySize(str_array_copy1D_bigger,3)
|
||||
Print "str_array_copy1D_smaller[0] Value: expected=\qzero\q, returned=\q"; str_array_copy1D_bigger[0];"\q"
|
||||
Print "str_array_copy1D_smaller[4] Value: expected=\qFoUr\q, returned=\q"; str_array_copy1D_bigger[4];"\q"
|
||||
Print "str_array_copy1D_smaller[10] Value: expected=\qten\q, returned=\q"; str_array_copy1D_bigger[10];"\q"
|
||||
Print ""
|
||||
Print dash_line$
|
||||
Print ""
|
||||
|
||||
Print "type_array_copy1D_smaller[] Size: expected=10,0,0, returned="; ArraySize(type_array_copy1D_smaller,1); ","; ArraySize(type_array_copy1D_smaller,2); ","; ArraySize(type_array_copy1D_smaller,3)
|
||||
Print "type_array_copy1D_smaller[] Number Member Value: expected=42, returned="; type_array_copy1D_smaller[0].tst_t[3,4,7].t2_var1[5,3].y[4,2]
|
||||
Print "type_array_copy1D_smaller[] Number Member Value: expected=29.54, returned="; type_array_copy1D_smaller[0].tst_t[3,4,7].v1[4]
|
||||
Print "type_array_copy1D_smaller[] String Member Value: expected=\qtest type array Case Two\q, returned=\q"; type_array_copy1D_smaller[9].tst_t[6,4,8].t2_var1[5,3].txt_var2$[7];"\q"
|
||||
Print ""
|
||||
Print "type_array_copy1D_bigger[] Size: expected=10,0,0, returned="; ArraySize(type_array_copy1D_bigger,1); ","; ArraySize(type_array_copy1D_bigger,2); ","; ArraySize(type_array_copy1D_bigger,3)
|
||||
Print "type_array_copy1D_bigger[] Number Member Value: expected=42, returned="; type_array_copy1D_bigger[0].tst_t[3,4,7].t2_var1[5,3].y[4,2]
|
||||
Print "type_array_copy1D_bigger[] Number Member Value: expected=29.54, returned="; type_array_copy1D_bigger[0].tst_t[3,4,7].v1[4]
|
||||
Print "type_array_copy1D_bigger[] String Member Value: expected=\qtest type array Case Two\q, returned=\q"; type_array_copy1D_bigger[9].tst_t[6,4,8].t2_var1[5,3].txt_var2$[7];"\q"
|
||||
Print ""
|
||||
Print dash_line$
|
||||
Print ""
|
||||
|
||||
11
unit_test/unittest_conio.bas
Normal file
11
unit_test/unittest_conio.bas
Normal file
@@ -0,0 +1,11 @@
|
||||
Include "unittest_lib.bas"
|
||||
|
||||
cat("Console I/O")
|
||||
|
||||
FPrint("Single Line")
|
||||
Print "\n"
|
||||
FPrint("Two\nLines")
|
||||
Print "\n"
|
||||
user_input$ = Input$("Enter Something: ")
|
||||
Print ""
|
||||
Print "You type: "; user_input$
|
||||
9
unit_test/unittest_lib.bas
Normal file
9
unit_test/unittest_lib.bas
Normal file
@@ -0,0 +1,9 @@
|
||||
Include Once
|
||||
|
||||
Sub cat( cat_name$ )
|
||||
Print""
|
||||
Print "---------------------["; UCase$(cat_name$); " Test]---------------------"
|
||||
End Sub
|
||||
|
||||
dash_line$ = "--------------------------------------------------------------------------"
|
||||
|
||||
200
unit_test/unittest_strings.bas
Normal file
200
unit_test/unittest_strings.bas
Normal file
@@ -0,0 +1,200 @@
|
||||
Include "unittest_lib.bas"
|
||||
|
||||
cat("Strings")
|
||||
|
||||
Dim txt$
|
||||
|
||||
Print "txt$=\q\q"
|
||||
Print ""
|
||||
Print "txt Len: Expected=0 Returned="; Len(txt$)
|
||||
Print "txt Size: Expected=0 Returned="; Size(txt$)
|
||||
|
||||
Print ""
|
||||
|
||||
txt = "hello world"
|
||||
|
||||
Print "txt$=\q"; txt; "\q"
|
||||
Print ""
|
||||
Print "txt Len: Expected=11 Returned="; Len(txt$)
|
||||
Print "txt Size: Expected=11 Returned="; Size(txt$)
|
||||
|
||||
Print ""
|
||||
|
||||
txt = "こんにちは世界"
|
||||
|
||||
Print "txt$=\q"; txt; "\q"
|
||||
Print ""
|
||||
Print "txt Len: Expected=7 Returned="; Len(txt$)
|
||||
Print "txt Size: Expected=21 Returned="; Size(txt$)
|
||||
|
||||
Print ""
|
||||
|
||||
Print "txt ASC: Expected=12371 Returned="; Asc(txt)
|
||||
|
||||
txt = "ABCDE"
|
||||
Print "txt$=\q"; txt; "\q"
|
||||
Print ""
|
||||
Print "txt ASC: Expected=65 Returned="; Asc(txt)
|
||||
Print ""
|
||||
|
||||
txt = "B"
|
||||
Print "txt$=\q"; txt; "\q"
|
||||
Print ""
|
||||
Print "txt ASC: Expected=66 Returned="; Asc(txt)
|
||||
Print ""
|
||||
|
||||
|
||||
txt = ""
|
||||
Print "txt$=\q"; txt; "\q"
|
||||
Print ""
|
||||
Print "txt ASC: Expected=0 Returned="; Asc(txt)
|
||||
Print ""
|
||||
|
||||
Print "Chr$: Expected=\q界\q"; " Returned=\q"; Chr$(30028); "\q"
|
||||
Print ""
|
||||
|
||||
txt = "ちは世界"
|
||||
|
||||
txt = Insert(txt, "ん", 3)
|
||||
|
||||
Print "Insert$: Expected=\qちは世ん界\q"; " Returned=\q"; Insert(txt, "ん", 3); "\q"
|
||||
Print ""
|
||||
|
||||
i = InStr(txt, "ん")
|
||||
|
||||
Print "InStr$: Expected=3"; " Returned="; i
|
||||
Print ""
|
||||
|
||||
Print "LCase$: Expected=\qhello world\q"; " Returned=\q"; LCase$("HELLO world"); "\q"
|
||||
Print "LCase$: Expected=\q\q"; " Returned=\q"; LCase$(""); "\q"
|
||||
Print ""
|
||||
|
||||
Print "UCase$: Expected=\qHELLO WORLD\q"; " Returned=\q"; UCase$("HELLO world"); "\q"
|
||||
Print "UCase$: Expected=\q\q"; " Returned=\q"; UCase$(""); "\q"
|
||||
Print ""
|
||||
|
||||
txt = "hello world"
|
||||
Print "Left$: Expected=\qhel\q"; " Returned=\q"; Left$(txt, 3); "\q"
|
||||
txt = "ちは世ん界"
|
||||
Print "Left$: Expected=\qちは世\q"; " Returned=\q"; Left$(txt, 3); "\q"
|
||||
txt = ""
|
||||
Print "Left$: Expected=\q\q"; " Returned=\q"; Left$(txt, 3); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = "hello world"
|
||||
Print "Right$: Expected=\qrld\q"; " Returned=\q"; Right$(txt, 3); "\q"
|
||||
txt = "ちは世ん界"
|
||||
Print "Right$: Expected=\q世ん界\q"; " Returned=\q"; Right$(txt, 3); "\q"
|
||||
txt = ""
|
||||
Print "Right$: Expected=\q\q"; " Returned=\q"; Right$(txt, 3); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = "hello world"
|
||||
Print "Mid$: Expected=\qlo w\q"; " Returned=\q"; Mid$(txt, 3, 4); "\q"
|
||||
txt = "ちは世ん界"
|
||||
Print "Mid$: Expected=\qは世\q"; " Returned=\q"; Mid$(txt, 1, 2); "\q"
|
||||
txt = ""
|
||||
Print "Mid$: Expected=\q\q"; " Returned=\q"; Mid$(txt, 1, 2); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = " hello world "
|
||||
Print "LTrim$: Expected=\qhello world \q"; " Returned=\q"; LTrim$(txt); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "LTrim$: Expected=\qちは世ん界 \q"; " Returned=\q"; LTrim$(txt); "\q"
|
||||
txt = " "
|
||||
Print "LTrim$: Expected=\q\q"; " Returned=\q"; LTrim$(txt); "\q"
|
||||
txt = ""
|
||||
Print "LTrim$: Expected=\q\q"; " Returned=\q"; LTrim$(txt); "\q"
|
||||
Print ""
|
||||
|
||||
txt = " hello world "
|
||||
Print "RTrim$: Expected=\q hello world\q"; " Returned=\q"; RTrim$(txt); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "RTrim$: Expected=\q ちは世ん界\q"; " Returned=\q"; RTrim$(txt); "\q"
|
||||
txt = " "
|
||||
Print "RTrim$: Expected=\q\q"; " Returned=\q"; RTrim$(txt); "\q"
|
||||
txt = ""
|
||||
Print "RTrim$: Expected=\q\q"; " Returned=\q"; RTrim$(txt); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = " hello world "
|
||||
Print "Trim$: Expected=\qhello world\q"; " Returned=\q"; Trim$(txt); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "Trim$: Expected=\qちは世ん界\q"; " Returned=\q"; Trim$(txt); "\q"
|
||||
txt = " "
|
||||
Print "Trim$: Expected=\q\q"; " Returned=\q"; Trim$(txt); "\q"
|
||||
txt = ""
|
||||
Print "Trim$: Expected=\q\q"; " Returned=\q"; Trim$(txt); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = " hello world "
|
||||
Print "Replace$: Expected=\qheppo worpd\q"; " Returned=\q"; Replace$(txt,"l", "p"); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "Replace$: Expected=\q ちhelloん界 \q"; " Returned=\q"; Replace$(txt, "は世", "hello"); "\q"
|
||||
txt = " "
|
||||
Print "Replace$: Expected=\qz \q"; " Returned=\q"; Replace$(txt, " ", "z"); "\q"
|
||||
txt = ""
|
||||
Print "Replace$: Expected=\q\q"; " Returned=\q"; Replace$(txt, "", "zzz"); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = " hello world "
|
||||
Print "ReplaceSubstr$: Expected=\q ghjillo world \q"; " Returned=\q"; ReplaceSubstr$(txt,"ghji",3); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "ReplaceSubstr$: Expected=\q ghji世ん界 \q"; " Returned=\q"; ReplaceSubstr$(txt, "ghji", 3); "\q"
|
||||
txt = " "
|
||||
Print "ReplaceSubstr$: Expected=\q z \q"; " Returned=\q"; ReplaceSubstr$(txt, "z", 1); "\q"
|
||||
txt = ""
|
||||
Print "ReplaceSubstr$: Expected=\q\q"; " Returned=\q"; ReplaceSubstr$(txt, "zzz", 0); "\q"
|
||||
Print ""
|
||||
|
||||
|
||||
txt = " hello world "
|
||||
Print "Reverse$: Expected=\q dlrow olleh \q"; " Returned=\q"; Reverse$(txt); "\q"
|
||||
txt = " ちは世ん界 "
|
||||
Print "Reverse$: Expected=\q 界ん世はち \q"; " Returned=\q"; Reverse$(txt); "\q"
|
||||
txt = " "
|
||||
Print "Reverse$: Expected=\q \q"; " Returned=\q"; Reverse$(txt); "\q"
|
||||
txt = ""
|
||||
Print "Reverse$: Expected=\q\q"; " Returned=\q"; Reverse$(txt); "\q"
|
||||
Print ""
|
||||
|
||||
Print "StringFill$: Expected=\qzzz\q"; " Returned=\q"; StringFill$("z", 3); "\q"
|
||||
Print "StringFill$: Expected=\q\q"; " Returned=\q"; StringFill$("", 3); "\q"
|
||||
Print "StringFill$: Expected=\q界ん界ん界ん界ん\q"; " Returned=\q"; StringFill$("界ん", 4); "\q"
|
||||
Print "StringFill$: Expected=\q\q"; " Returned=\q"; StringFill$("AB", 0); "\q"
|
||||
|
||||
Print ""
|
||||
Print "Str$: Expected=\q21\q"; " Returned=\q"; Str$(21); "\q"
|
||||
Print "Str$: Expected=\q-1\q"; " Returned=\q"; Str$(-1); "\q"
|
||||
Print "Str$: Expected=\q0\q"; " Returned=\q"; Str$(0); "\q"
|
||||
Print "Str$: Expected=\q3.1234\q"; " Returned=\q"; Str$(3.1234); "\q"
|
||||
|
||||
Print ""
|
||||
Print "Str_F$: Expected=\q21.000000\q"; " Returned=\q"; Str_F$(21); "\q"
|
||||
Print "Str_F$: Expected=\q-1.000000\q"; " Returned=\q"; Str_F$(-1); "\q"
|
||||
Print "Str_F$: Expected=\q0.000000\q"; " Returned=\q"; Str_F$(0); "\q"
|
||||
Print "Str_F$: Expected=\q3.123400\q"; " Returned=\q"; Str_F$(3.1234); "\q"
|
||||
|
||||
Print ""
|
||||
Print "Str_S$: Expected=\q2.100000e+01\q"; " Returned=\q"; Str_S$(21); "\q"
|
||||
Print "Str_S$: Expected=\q-1.000000e+00\q"; " Returned=\q"; Str_S$(-1); "\q"
|
||||
Print "Str_S$: Expected=\q0.000000e+00\q"; " Returned=\q"; Str_S$(0); "\q"
|
||||
Print "Str_S$: Expected=\q3.123400e+00\q"; " Returned=\q"; Str_S$(3.1234); "\q"
|
||||
Print ""
|
||||
|
||||
Print "Tally: Expected=4"; " Returned="; Tally("tallyhotallyhotallyhotallyho", "tally")
|
||||
Print "Tally: Expected=0"; " Returned="; Tally("tallyhotallyhotallyhotallyho", "yes")
|
||||
Print "Tally: Expected=3"; " Returned="; Tally("界ん界ん界ん界ん", "界ん界")
|
||||
Print "Tally: Expected=2"; " Returned="; Tally("tallyhotallyhotallyho", "hotally")
|
||||
|
||||
/'
|
||||
function Val(n$)
|
||||
function BufferFromString(s$, ByRef buffer)
|
||||
function StringFromBuffer$(ByRef buffer, buffer_size)
|
||||
'/
|
||||
Reference in New Issue
Block a user