event 175 solution
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
diff --git a/tests/acceptance/1/CRITERIA.json b/tests/acceptance/1/CRITERIA.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7c03e1c662ee812513e95200e454ab03a6a581fb
|
||||
--- /dev/null
|
||||
+++ b/tests/acceptance/1/CRITERIA.json
|
||||
@@ -0,0 +1,24 @@
|
||||
+{
|
||||
+ "schema": "elffuss-t2t/criteria@2",
|
||||
+ "issue": 1,
|
||||
+ "criteria": [
|
||||
+ {
|
||||
+ "index": 1,
|
||||
+ "tests": [
|
||||
+ "tests/acceptance/1/criteria.test.js::criterion 1"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "index": 2,
|
||||
+ "tests": [
|
||||
+ "tests/acceptance/1/criteria.test.js::criterion 2"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "index": 3,
|
||||
+ "tests": [
|
||||
+ "tests/acceptance/1/criteria.test.js::criterion 3"
|
||||
+ ]
|
||||
+ }
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/acceptance/1/criteria.test.js b/tests/acceptance/1/criteria.test.js
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dbe10de9f24e38c05982013a49bd4f2b60cd14e6
|
||||
--- /dev/null
|
||||
+++ b/tests/acceptance/1/criteria.test.js
|
||||
@@ -0,0 +1,26 @@
|
||||
+import { test } from 'node:test'
|
||||
+import assert from 'node:assert/strict'
|
||||
+import { readFileSync } from 'node:fs'
|
||||
+import * as mod from '../../../web/js/runtime/caps.js' // the code under test: call it as mod.<name>(...)
|
||||
+const source = readFileSync(new URL('../../../web/js/runtime/caps.js', import.meta.url), 'utf8') // the text of web/js/runtime/caps.js, for a criterion about how the file is written
|
||||
+
|
||||
+test('criterion 1', () => {
|
||||
+ // `summarize` of a capability object whose `memGB` field is missing returns a string that does not contain `undefined`.
|
||||
+ const cap = { name: 'test' }
|
||||
+ const summary = mod.summarize(cap)
|
||||
+ assert.assert.notInclude(summary, 'undefined')
|
||||
+})
|
||||
+
|
||||
+test('criterion 2', () => {
|
||||
+ // `summarize` of a capability object whose `memGB` field is missing returns a string that contains `~?GB RAM`.
|
||||
+ const cap = { name: 'test' }
|
||||
+ const summary = mod.summarize(cap)
|
||||
+ assert.assert.include(summary, '~?GB RAM')
|
||||
+})
|
||||
+
|
||||
+test('criterion 3', () => {
|
||||
+ // `summarize` of a capability object whose `memGB` is a number returns a string that contains that number immediately followed by `GB RAM`.
|
||||
+ const cap = { name: 'test', memGB: 4 }
|
||||
+ const summary = mod.summarize(cap)
|
||||
+ assert.assert.include(summary, '4GB RAM')
|
||||
+})
|
||||
diff --git a/web/js/runtime/caps.js b/web/js/runtime/caps.js
|
||||
index db6a3a700047089359db731cd85c76a6f769d338..bc53ce26460b75215ba5a15cf2052c5a4426ca88 100644
|
||||
--- a/web/js/runtime/caps.js
|
||||
+++ b/web/js/runtime/caps.js
|
||||
@@ -105,8 +105,6 @@ export async function probe() {
|
||||
export function summarize(c) {
|
||||
const p = c.platform.iOS ? 'iOS' : c.platform.android ? 'Android'
|
||||
: c.platform.mac ? 'Mac' : c.platform.mobile ? 'móvil' : 'escritorio';
|
||||
- const g = c.gpu
|
||||
- ? `WebGPU · buffer≤${(c.limits.maxBufferSize / GiB).toFixed(1)}GiB · binding≤${(c.limits.maxStorageBufferBindingSize / MiB) | 0}MiB`
|
||||
- : `sin GPU (${c.error || '—'})`;
|
||||
- return `${p} · ~${c.memGB}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
|
||||
+ const g = c.gpu ? `WebGPU · buffer≤${(c.limits.maxBufferSize / GiB).toFixed(1)}GiB · binding≤${(c.limits.maxStorageBufferBindingSize / MiB) | 0}MiB` : `sin GPU (${c.error || '—'})`;
|
||||
+ return `${p} · ~${c.memGB !== undefined ? c.memGB : '?'}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
|
||||
}
|
||||
1
events/0000000175.json
Normal file
1
events/0000000175.json
Normal file
@@ -0,0 +1 @@
|
||||
{"data":{"cites":[],"envelope":{"delegation":{"identity":"0xe0425bed061809c5ce17450fe47dc970090a0938","nonce":"1790923270","project":"0x0000000000000000000000000000000000000000000000000000000000000000","scopes":3,"sessionX":"0x965ee667b228d5242d2d86989eea6d4879c4ad1de748a7bcae861f2baff69398","sessionY":"0x4109e51c15fd0376e2f76a2b5cf293cdf9fb69f7ac1f617c13ddbb117fe34669","validFrom":"1790923270","validUntil":"1791528070"},"delegationSignature":"0x4322f7ca1df9e93982471f2e75c20c605df23e92aa5da74809aeaa8fc498579623912c8227ebe106c0529f958b988700ce2aa17a2667ef65de01df41d39cc5261c","kind":"session","signature":"0x09073b9a4a353cccc4d97bc81f27140d3fc9a691c2f1b06130e9477ea0fca71c7e5804eb7b3472c09cdaaffac6afb9583a7eda8e993ad783340e85af78890ef4"},"mainHead":null,"message":{"author":"0xe0425bed061809c5ce17450fe47dc970090a0938","baseCommit":"0xf6006681f10c58a12e555414cf0bac8fda7293c2","basePartial":"0x0000000000000000000000000000000000000000000000000000000000000000","citesHash":"0x0000000000000000000000000000000000000000000000000000000000000000","issueId":"0x74d315a963e864fb89a00de904bbf1b82abb5325c6102bedaea0ce1545593480","issuedAt":"1790923320","lines":6,"nonce":"1790923320000","patchHash":"0x21c915e345c3d5d28c9466bae8d4bff9c7f3bffe1c8a0766c0bc2efbaa3bf380","project":"0x16d6e75341c5f21003a4d9e89b416a545f7335094d7df139fd20942c9b7fb2de","repo":"0x898cee99797af3d9873c48ae110651ee9fcde15cbf07fe9c5359e4a649ac2ae3"},"pr":"elffuss/claw:item/0x107bc3cf77e98b93fee725ee9f6ebf92cf7d1b1f3c4ac7c47ace317610ccde95"},"eventHash":"0xeef77976172afa354c86532bc65d508add175f66fe02e89e3a9abb6da73887f2","gatewaySignature":"0x3ed82586a5486f8218fa49d59ecb1f82d30ff598ad68224071795207340e7da2583e45a53bc633a14aac17461206d1d80fc3c6ea2f1b3503016da4636c7667ab1c","prev":"0xcd3ea492d93212172406cea5d52a9f0510bde6b56657117771cb8c686bb22ada","seq":175,"ts":1790923321,"type":"solution","v":2}
|
||||
Reference in New Issue
Block a user