Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add unit tests for noiseDetail()

Aperta Adatta ai principianti
#9,253 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Pcmhacker-piro ci sta già lavorando.

Dal 6/10/2026.

  • #9255 di @Pcmhacker-piro — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
testing

Direzione di ricerca

Leggi src/math/noise.js nella zona di noiseDetail() e i test esistenti in test/unit/math/noise.js. Aggiungi test per l'impostazione di octaves e falloff, valori non validi e falloff omesso; ripristina lo stato predefinito successivamente in modo che gli altri test non siano influenzati. Esegui i test unitari di noise e aggiorna il commento obsoleto; completato quando i comportamenti richiesti sono coperti e la suite viene superata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area:Math Enhancement
Increasing access

Tests make noiseDetail()'s behaviour explicit and protect it from regressions, so sketches that rely on it keep working across releases. They also give new contributors a clear reference for how the function is meant to behave.

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
Feature enhancement details

noiseDetail() (src/math/noise.js:403-410) has no unit tests. test/unit/math/noise.js:19 notes this:

// ALso need test for noiseSeed and noiseDetail

noiseSeed has since been covered (lines 36-60), but noiseDetail hasn't.

The private getters _getNoiseOctaves() and _getNoiseAmpFalloff() (lines 416-425) make the state directly assertable. Proposed tests:

  • sets octaves and falloff when both are given
  • ignores lod <= 0 and falloff <= 0, keeping the previous values
  • when falloff is omitted it defaults to 0.5, so a previously set falloff is reset rather than kept

Since the suite shares one mockP5Prototype and noiseDetail state persists in the module closure, the new tests would restore the defaults (4 octaves, 0.5 falloff) afterwards so the existing noise() tests aren't affected.

I'd also update the comment at line 19, since noiseSeed is now tested.

Checked against main at 3193703. The strands noiseDetail tests in the WebGL/WebGPU shader suites cover state leaking between shaders, not this function.

I'd like to fix this myself if approved.

Lingua principale
JavaScript
Stelle
24.1k
Fork
3.9k
Merge medio
3g 17h
PR unite (30g)
33

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di processing/p5.js

Tutte le issue di processing/p5.js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.