1b1df11df5b7bdcc201852bfcdce0a8eace33b011svenpanne@chromium.org// Copyright 2012 the V8 project authors. All rights reserved.
29a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Redistribution and use in source and binary forms, with or without
39a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// modification, are permitted provided that the following conditions are
49a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// met:
59a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//
69a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//     * Redistributions of source code must retain the above copyright
79a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       notice, this list of conditions and the following disclaimer.
89a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//     * Redistributions in binary form must reproduce the above
99a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       copyright notice, this list of conditions and the following
109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       disclaimer in the documentation and/or other materials provided
119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       with the distribution.
129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//     * Neither the name of Google Inc. nor the names of its
139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       contributors may be used to endorse or promote products derived
149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//       from this software without specific prior written permission.
159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com//
169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com#include <stdlib.h>
299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
30196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/v8.h"
319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
32196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "src/ast.h"
33196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org#include "test/cctest/cctest.h"
349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comusing namespace v8::internal;
369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comTEST(List) {
380b6db5975a9d1ebcf3de7b18603380d99f789e66sgjesse@chromium.org  List<AstNode*>* list = new List<AstNode*>(0);
399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(0, list->length());
409a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
41528ce02b8680a3ab6d75c7079f180a4016c69b7amachenbach@chromium.org  Isolate* isolate = CcTest::i_isolate();
421510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org  Zone zone(isolate);
43a8702c210b949f35c64d8e4aa01bb6d525086c85machenbach@chromium.org  AstNode::IdGen id_gen;
44a8702c210b949f35c64d8e4aa01bb6d525086c85machenbach@chromium.org  AstNodeFactory<AstNullVisitor> factory(&zone, NULL, &id_gen);
45a2e1a40f85577979749d4c0d6de30e992d996659mstarzinger@chromium.org  AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition);
469a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  list->Add(node);
479a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(1, list->length());
489a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(node, list->at(0));
499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(node, list->last());
509a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
519a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  const int kElements = 100;
529a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  for (int i = 0; i < kElements; i++) {
539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com    list->Add(node);
549a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  }
559a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(1 + kElements, list->length());
569a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com
579a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  list->Clear();
589a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com  CHECK_EQ(0, list->length());
59bb29dc9819bb6f495ab6eddd2543965eb97a8e43ager@chromium.org  delete list;
609a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}
61