Write-Host '=== Test 1: Variables and Assignment ===' -ForegroundColor 'Green'
$simplevar = 'Hello World'
$numbervar = 42
$floatvar = 3.14159
$boolvar = $true
$nullvar = $null
Write-Output 'Simple: Hello World'
Write-Output 'Number: 42'
Write-Output 'Float: 3.14159'
Write-Output 'Boolean: True'
Write-Output 'Null: '
Write-Output 'Mixed types: $(3 + "invalid")'
Write-Host '=== Test 4: String Operations ===' -ForegroundColor 'Green'
$str1 = 'Hello'
$str2 = 'World'
Write-Output 'Concatenation: Hello World'
Write-Output 'String multiplication: HelloHelloHello'
Write-Output 'String interpolation: Hello, World!'
Write-Host '=== Test 5: Comparison Operators ===' -ForegroundColor 'Green'
$x = 10
$y = 20
Write-Output 'Equal: False'
Write-Output 'Not Equal: True'
Write-Output 'Greater Than: False'
Write-Output 'Less Than: True'
Write-Output 'Greater or Equal: False'
Write-Output 'Less or Equal: True'
Write-Host '=== Test 6: Logical Operators ===' -ForegroundColor 'Green'
$true1 = $true
$false1 = $false
Write-Output 'AND: False'
Write-Output 'OR: True'
Write-Output 'NOT: False'
Write-Output 'XOR: True'
Write-Host '=== Test 7: Arrays ===' -ForegroundColor 'Green'
$array1 = @(1,2,3,4,5)
$array2 = @('apple','banana','cherry')
$mixedarray = @(1,'two',3,$true,$null)
Write-Output 'Number array: 1 2 3 4 5'
Write-Output 'String array: apple banana cherry'
Write-Output 'Mixed array: 1 two 3 True '
Write-Output 'Array length: 5'
Write-Output 'First element: 1'
Write-Host '=== Test 8: Ranges ===' -ForegroundColor 'Green'
$range1 = @(1,2,3,4,5)
$range2 = @(10,9,8,7,6,5,4,3,2,1)
Write-Output 'Ascending range: 1 2 3 4 5'
Write-Output 'Descending range: 10 9 8 7 6 5 4 3 2 1'
Write-Host '=== Test 9: Hash Tables ===' -ForegroundColor 'Green'
$hash = @{
	age = 30
	city = 'New York'
	name = 'John'
}
Write-Output 'Hash table: System.Collections.Hashtable'
Write-Output 'Name: John'
Write-Output 'Age: 30'
Write-Host '=== Test 10: Conditional Statements ===' -ForegroundColor 'Green'
$score = 85
Write-Output 'Grade: B'
Write-Host '=== Test 11: Switch Statements ===' -ForegroundColor 'Green'
$day = 'Monday'
switch ($day) {
    "Monday" { Write-Output "Start of work week" }
    "Friday" { Write-Output "TGIF!" }
    "Saturday" { Write-Output "Weekend!" }
    "Sunday" { Write-Output "Weekend!" }
    default { Write-Output "Regular day" }
}
Write-Host '=== Test 12: For Loop ===' -ForegroundColor 'Green'
for ($i = 1; $i -le 5; $i++) {
    Write-Output "For loop iteration: $i"
}
Write-Host '=== Test 13: While Loop ===' -ForegroundColor 'Green'
$counter = 1
while ($counter -le 3) {
    Write-Output "While loop iteration: $counter"
    $counter++
}
Write-Host '=== Test 14: ForEach Loop ===' -ForegroundColor 'Green'
$fruits = @('apple','banana','orange')
foreach ($fruit in $fruits) {
    Write-Output "Fruit: $fruit"
}
Write-Host '=== Test 15: Functions ===' -ForegroundColor 'Green'
function Get-Square($number) {
    return $number * $number
}
function Get-Greeting($name = "World") {
    return "Hello, $name!"
}
Write-Output 'Square of 5: $(Get-Square 5)'
Write-Output 'Greeting: $(Get-Greeting)'
Write-Output 'Greeting with name: $(Get-Greeting "Alice")'
Write-Host '=== Test 16: Advanced Function ===' -ForegroundColor 'Green'
function Test-Parameters {
    param(
        [string]$Name,
        [int]$Age = 25,
        [switch]$Verbose
    )
    
    $result = "Name: $Name, Age: $Age"
    if ($Verbose) {
        $result += " (Verbose mode)"
    }
    return $result
}


Write-Output '$(Test-Parameters -Name "Bob" -Age 30 -Verbose)'
Write-Host '=== Test 17: String Matching ===' -ForegroundColor 'Green'
$text = 'PowerShell is awesome'
Write-Output 'Contains 'Shell': True'
Write-Output 'Starts with 'Power': True'
Write-Output 'Matches regex: True'
Write-Host '=== Test 18: Type Casting ===' -ForegroundColor 'Green'
$stringnumber = '123'
$intnumber = 123
$floatnumber = 123
Write-Output 'String: 123 (Type: String)'
Write-Output 'String: 123 (Type: String)'
Write-Output 'Int: 123 (Type: Int32)'
Write-Output 'Float: 123 (Type: Double)'
Write-Host '=== Test 19: Error Handling ===' -ForegroundColor 'Green'
$successful = 2
Write-Output 'Successful operation result: 2'
Write-Output 'Last operation success: True'
$failed = 3 + "invalid string"

Write-Output 'Failed operation result: '
Write-Output 'Last operation success after error: True'
Write-Host '=== Test 20: Complex Expressions ===' -ForegroundColor 'Green'
$result = 10
Write-Output 'Complex arithmetic: 10'
$complexcondition = $true
Write-Output 'Complex logical: True'
Write-Host '=== Test 21: Pipeline Operations ===' -ForegroundColor 'Green'
$numbers = @(1,2,3,4,5,6,7,8,9,10)
$evennumbers = @(2,4,6,8,10)
Write-Output 'Even numbers: 2 4 6 8 10'
Write-Host '=== Test 22: Special Variables ===' -ForegroundColor 'Green'
Write-Output 'PowerShell Version: $PSVersionTable.PSVersion'
Write-Output 'Execution Policy: $(Get-ExecutionPolicy)'
Write-Output 'Current Location: $(Get-Location)'
Write-Host '=== Test 23: Nested Structures ===' -ForegroundColor 'Green'
$nesteddata = @{
	settings = @{
	language = 'en-US'
	theme = 'Dark'
}
	users = @(@{
	age = 30
	name = 'Alice'
	skills = @('PowerShell','Python')
},@{
	age = 25
	name = 'Bob'
	skills = @('Java','C#')
})
}
Write-Output 'First user: Alice'
Write-Output 'First user skills: PowerShell, Python'
Write-Output 'First user skills: , '
Write-Output 'Theme setting: Dark'
Write-Host '=== Test 24: Comments ===' -ForegroundColor 'Green'
Write-Output 'Single line comment test'
Write-Output 'Multi-line comment test'
Write-Host '=== Test 25: Script Blocks ===' -ForegroundColor 'Green'
$scriptblock = {param($x, $y) return $x + $y
}
$result = & $scriptBlock 10 20
Write-Output "Script block result: $result"

Write-Host "=== All Tests Completed ===" -ForegroundColor Cyan
Write-Output "Test script execution finished. Check results above for any parsing issues."
