Files
prometeu-studio/prometeu-studio-api/src/test/java/p/studio/api/automation/GuestTestsTest.java
T
bquarkz 1471b427f1
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/pr-master There was a failure building this commit
feat(studio): deliver asset authoring and automation workflows
Add shared human/task asset batches with reviewed atomic publication, explicit
reference rebinds, ownership inspection and qualified glyph/scene budgets.
Expose the same authoring and capacity results through Assets and MCP.

Deliver isolated guest test targets, retained visual evidence and immutable
runtime lifecycle/control observations. Preserve provider qualification and
installed authoring examples alongside the completed discussion lessons.

Close AGD-106 coordination and the delivered discussion workflows through
housekeeping, updating lesson references and preserving qualification limits.
Sound remains outside the asset delivery wave.

Validation: 579 module tests and 31 additional desktop, process and installed
checks passed; native glyph/scene 16/17 boundaries qualified. Discussion
validation passed after housekeeping.
2026-11-11 01:21:25 +00:00

42 lines
3.7 KiB
Java

package p.studio.api.automation;
import org.junit.jupiter.api.Test;
import java.math.BigInteger;
import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
class GuestTestsTest {
GuestTests.Target target(String id) {return new GuestTests.Target(id,"tests/"+id+"/main.pbs",List.of("src","tests/"+id),List.of("tests/support"),List.of("src/main.pbs"),List.of("first","second"),41000);}
@Test void twoTargetsAndOmittedProductionSelectionDoNotChangeProjectMachineIdentity() {
var catalog=new GuestTests.Catalog(1,List.of(target("life"),target("shop-save")));
assertEquals(2,catalog.targets().size());assertTrue(new GuestTests.Selection(null).production());assertFalse(new GuestTests.Selection("life").production());
assertThrows(IllegalArgumentException.class,()->new GuestTests.Catalog(1,List.of(target("life"),target("life"))));
assertThrows(IllegalArgumentException.class,()->target("production"));assertThrows(IllegalArgumentException.class,()->new GuestTests.Catalog(2,List.of()));
assertThrows(IllegalArgumentException.class,()->new GuestTests.Target("escape","../main.pbs",List.of("src"),List.of(),List.of(),List.of(),1));
}
@Test void provenanceAndSequenceZeroThroughUint64MaximumAreImmutableAndLossless() {
var hashes=new HashMap<String,String>();hashes.put("src/main.pbs","a".repeat(64));
var provenance=new GuestTests.BuildProvenance("life","build","tests/life/main.pbs",hashes,Map.of(),Map.of(),Map.of("target","Game"),"revision");
hashes.clear();assertEquals(1,provenance.sourceSha256().size());
var zero=new GuestTests.LogEvent(BigInteger.ZERO,BigInteger.ZERO,BigInteger.ZERO,"info","app",3L,41000,"{}");
var max=new BigInteger("18446744073709551615");var last=new GuestTests.LogEvent(max,max,max,"info","app",3L,41000,"{}");
var page=new GuestTests.LogPage("session",BigInteger.ZERO,List.of(zero),BigInteger.ZERO,BigInteger.ZERO,BigInteger.ZERO,false,false);
var finalPage=new GuestTests.LogPage("session",BigInteger.ONE,List.of(last),max,max,max,true,true);
assertEquals(BigInteger.ZERO,page.events().getFirst().sequence());assertEquals(max,finalPage.nextAfterSequence());
assertThrows(IllegalArgumentException.class,()->new GuestTests.LogPage("session",BigInteger.ZERO,List.of(last,zero),BigInteger.ZERO,max,max,false,false));
}
@Test void everyCaseStateIsRepresentableButEmptyIncompleteOrFailedAssertionsCannotPass() {
for(var state:GuestTests.CaseState.values())assertEquals(state,new GuestTests.CaseResult("case",state,List.of(),List.of()).state());
assertThrows(IllegalArgumentException.class,()->result(GuestTests.Completion.completed,false,List.of()));
var passed=new GuestTests.CaseResult("case",GuestTests.CaseState.passed,List.of(new GuestTests.Assertion("health","public API",10,10,true)),List.of());
assertEquals(GuestTests.CaseState.passed,result(GuestTests.Completion.completed,true,List.of(passed)).verdict());
assertThrows(IllegalArgumentException.class,()->result(GuestTests.Completion.timed_out,true,List.of(passed)));
assertThrows(IllegalArgumentException.class,()->result(GuestTests.Completion.cancelled,true,List.of(passed)));
var failed=new GuestTests.CaseResult("case",GuestTests.CaseState.failed,List.of(new GuestTests.Assertion("health","mismatch",10,9,false)),List.of());
assertThrows(IllegalArgumentException.class,()->result(GuestTests.Completion.completed,true,List.of(failed)));
}
GuestTests.RunResult result(GuestTests.Completion completion,boolean complete,List<GuestTests.CaseResult> cases) {
return new GuestTests.RunResult("run","life","build","session","operation","request",completion,GuestTests.CaseState.passed,complete,false,cases,List.of(),null);
}
}