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


Quelle  test_streamcopier.js   Sprache: JAVA

 
"use strict";

var testStr = "This is a test. ";
for (var i = 0; i < 10; ++i) {
  testStr += testStr;
}

function run_test() {
  // Set up our stream to copy
  var inStr = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
    Ci.nsIStringInputStream
  );
  inStr.setByteStringData(testStr);

  // Set up our destination stream.  Make sure to use segments a good
  // bit smaller than our data length.
  Assert.ok(testStr.length > 1024 * 10);
  var pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
  pipe.init(truetrue, 1024, 0xffffffff, null);

  var streamCopier = Cc[
    "@mozilla.org/network/async-stream-copier;1"
  ].createInstance(Ci.nsIAsyncStreamCopier);
  streamCopier.init(
    inStr,
    pipe.outputStream,
    null,
    true,
    true,
    1024,
    true,
    true
  );

  var ctx = {};
  ctx.wrappedJSObject = ctx;

  var observer = {
    onStartRequest() {},
    onStopRequest(aRequest, aStatusCode) {
      Assert.equal(aStatusCode, 0);
      var sis = Cc["@mozilla.org/scriptableinputstream;1"].createInstance(
        Ci.nsIScriptableInputStream
      );
      sis.init(pipe.inputStream);
      var result = "";
      var temp;
      try {
        // Need this because read() can throw at EOF
        while ((temp = sis.read(1024))) {
          result += temp;
        }
      } catch (e) {
        Assert.equal(e.result, Cr.NS_BASE_STREAM_CLOSED);
      }
      Assert.equal(result, testStr);
      do_test_finished();
    },
  };

  streamCopier.asyncCopy(observer, ctx);
  do_test_pending();
}

Messung V0.5
C=93 H=95 G=93

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge