cda7198c76
Протокол: - ItemData читает таблицу items/items.csv (218 предметов ремейка) и отдает числа: урон, дальность, темп, прочность, сколько ресурса за удар. - ItemType: поля rid, researchScrap, techTreeBench, techTreeScrap, techTreeParent, admin. Урон по частям тела делится как в ремейке: голова вдвое, руки и ноги четыре пятых. Число в исходнике главнее таблицы. - ItemRegistry: 218 предметов с рецептами, ценой исследования и веткой дерева. Новые вещи: salvage-тесак, бронедвери, гаражи, взрывчатка, компоненты, еда, мусор, верстаки и печи. - NodeType: узлы с запасом (дерево 500/750/1000, камень 750, металл 500, сера 200) и меткой: крестик на дереве до двух, горячая точка на руде до трех. - TechTree: ветки верстаков с предками, 125/250/500 скрапа. - Новые пакеты: Dig, BreakProgress, CraftStart, CraftUpdate, ResearchStart, ResearchUpdate, TechTreeUnlock, KnownRecipes, TechTreeState, ContainerOpen, ContainerTake, LearnBlueprint. Сервер: - Knowledge: что игрок знает - рецепты и открытые узлы деревьев. - Crafter: проверка рецепта, уровня верстака и ингредиентов; время крафта по формуле плана. - ResearchTable: предмет плюс скрап, десять секунд, предмет превращается в чертёж; чертёж изучается и открывает рецепт. - ResourceNode: запас, метка, последний удар отдает остаток. - JunkPile: две-четыре бочки (серая - скрап и мусор, синяя - компонент, красная - нефть и топливо) и ящик с едой; пустая мусорка исчезает через 60-180 секунд. - RoadNetwork: сетка дорог и кольцо, точки спавна мусорки; генератор кладет асфальт и ровняет дорогу по ширине. - Проверка досягаемости вынесена из changeBlock, игрок получил benchLevel. - Сессия отвечает на новые пакеты, при входе шлет известные рецепты и открытые узлы. Тесты: протокол 24 + 10, сервер 74 (было 57). Форк собирается чисто.
66 lines
2.7 KiB
PowerShell
66 lines
2.7 KiB
PowerShell
# End to end test: a real server, a real socket, a real login.
|
|
#
|
|
# This is the test that matters for the login path. A unit test can show that a
|
|
# hash matches itself; only this shows that somebody can actually register,
|
|
# connect, prove a password, get a token, redeem it and arrive as a player, and
|
|
# that a wrong password does not.
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$Repo = Split-Path -Parent $PSScriptRoot
|
|
if (-not $Repo) { $Repo = $PSCommandPath | Split-Path -Parent | Split-Path -Parent }
|
|
$Workspace = Split-Path -Parent $Repo
|
|
$Out = Join-Path $Repo 'build'
|
|
|
|
function Say($text) { Write-Host " $text" -ForegroundColor Cyan }
|
|
|
|
$Protocol = Join-Path $Workspace 'rsx-protocol\build\classes'
|
|
$Auth = Join-Path $Workspace 'rsx-auth\build\classes'
|
|
foreach ($dep in @($Protocol, $Auth)) {
|
|
if (-not (Test-Path $dep)) {
|
|
Write-Host " Missing dependency: $dep" -ForegroundColor Red
|
|
Write-Host ' Build rsx-protocol and rsx-auth first.' -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $Out | Out-Null
|
|
|
|
$mainOut = Join-Path $Out 'classes'
|
|
Remove-Item $mainOut -Recurse -Force -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force -Path $mainOut | Out-Null
|
|
$mainFiles = @(Get-ChildItem (Join-Path $Repo 'src\main\java') -Recurse -Filter '*.java' |
|
|
ForEach-Object { $_.FullName })
|
|
$cp = "$Protocol;$Auth"
|
|
& javac -encoding UTF-8 --release 17 -Xlint:-options -nowarn -cp $cp -d $mainOut $mainFiles
|
|
if ($LASTEXITCODE -ne 0) { Write-Host ' Main failed.' -ForegroundColor Red; exit 1 }
|
|
|
|
$testOut = Join-Path $Out 'test-classes'
|
|
Remove-Item $testOut -Recurse -Force -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force -Path $testOut | Out-Null
|
|
$testFiles = @(Get-ChildItem (Join-Path $Repo 'src\test\java') -Recurse -Filter '*.java' |
|
|
ForEach-Object { $_.FullName })
|
|
& javac -encoding UTF-8 --release 17 -Xlint:-options -nowarn -cp "$cp;$mainOut" -d $testOut $testFiles
|
|
if ($LASTEXITCODE -ne 0) { Write-Host ' Test failed to compile.' -ForegroundColor Red; exit 1 }
|
|
Say "compiled $($mainFiles.Count) main + $($testFiles.Count) test files"
|
|
|
|
$suites = @(
|
|
'net.rustnotmc.server.ServerTest',
|
|
'net.rustnotmc.server.world.WorldTest',
|
|
'net.rustnotmc.server.world.NodeTest',
|
|
'net.rustnotmc.server.item.InventoryTest',
|
|
'net.rustnotmc.server.craft.CraftTest',
|
|
'net.rustnotmc.server.PlayTest'
|
|
)
|
|
foreach ($suite in $suites) {
|
|
Say "running $suite"
|
|
& java -cp "$cp;$mainOut;$testOut" $suite (Join-Path $Out 'selftest')
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host ''
|
|
Write-Host " $suite FAILED" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Host ''
|
|
Write-Host ' Server tests passed.' -ForegroundColor Green |