Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  bug1941446.js   Sprache: JAVA

 

function generateObjectLiteral(propCount, computedPropCount) {
  const parts = [];

  for (let i = 0; i < propCount; i++) {
    parts.push(`prop${i}: ${i}`);
  }

  for (let i = 0; i < computedPropCount; i++) {
    parts.push(`["computedProp${i}"]: ${i}`);
  }

  return `let obj = {${parts.join(",")}}`;
}

function assertPropCount(obj, count) {
  assertEq(Object.keys(obj).length === count, true);
}

const objectSizes = [0, 1, 2, 4, 8, 16, 255, 256];

// objects with computed properties only
function testComputedProperties() {
  for (let numOfProps of objectSizes) {
    let obj = Function(
      `${generateObjectLiteral(0, numOfProps)}; return obj;`
    ).call();
    assertPropCount(obj, numOfProps);
  }
}

// objects with one computed properties and the rest are normal;
function testMixedProperties() {
  for (let numOfProps of objectSizes) {
    let obj = Function(
      `${generateObjectLiteral(numOfProps, 1)}; return obj;`
    ).call();
    assertPropCount(obj, numOfProps + 1);
  }
}

// objects with normal properties only
function testNormalProperties() {
  for (let numOfProps of objectSizes) {
    let obj = Function(
      `${generateObjectLiteral(numOfProps, 0)}; return obj;`
    ).call();
    assertPropCount(obj, numOfProps);
  }
}

testNormalProperties();
testMixedProperties();
testComputedProperties();

Messung V0.5 in Prozent
C=93 H=76 G=84

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-09-29) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691