feat(android): warm voice interface and custom sampling up to one day v0.1.51

This commit is contained in:
Codex
2026-10-19 01:19:28 +08:00
parent e3afb2e07f
commit 0a7c4d9b96
28 changed files with 401 additions and 107 deletions
@@ -17,6 +17,15 @@ public class LocationCadenceTest {
require(LocationCadence.custom(3,true)==259200);assertions++;
require(LocationCadence.custom(5,false)==18000);assertions++;
for(int invalid:new int[]{-1,0,721,Integer.MAX_VALUE}){try{LocationCadence.custom(invalid,false);throw new AssertionError();}catch(IllegalArgumentException expected){assertions++;}}
for(int seconds:new int[]{10,11,30,60,120,300,900,1800,3600,7200,10800,14400,18000,21600,43200,86399,86400}){
require(LocationCadence.sample(seconds)==seconds);assertions++;
require(LocationCadence.sampleDue(10000,0,seconds));assertions++;
require(!LocationCadence.sampleDue(1000+seconds*1000L-1,1000,seconds));assertions++;
require(LocationCadence.sampleDue(1000+seconds*1000L,1000,seconds));assertions++;
}
for(int invalid:new int[]{-1,0,9,86401,604800,Integer.MAX_VALUE}){require(!LocationCadence.sampleValid(invalid));assertions++;}
for(int[] period:new int[][]{{30,1,30},{7,60,420},{7,3600,25200},{24,3600,86400},{1,86400,86400}}){require(LocationCadence.customSample(period[0],period[1])==period[2]);assertions++;}
for(int[] period:new int[][]{{0,60},{9,1},{25,3600},{2,86400},{7,86400},{1,17},{Integer.MAX_VALUE,86400}}){try{LocationCadence.customSample(period[0],period[1]);throw new AssertionError();}catch(IllegalArgumentException expected){assertions++;}}
System.out.println("Location cadence: "+assertions+" assertions passed");
}
}