1
0
Fork 0

more tests

This commit is contained in:
Frank Celler 2012-04-30 12:32:58 +02:00
parent 5bc4a3de27
commit 1ff5f2940a
5 changed files with 169 additions and 12 deletions

View File

@ -1022,6 +1022,7 @@ CLIENT_OPT := --startup.directory ./js --startup.modules-path ./js/client/module
SHELL_SERVER = @srcdir@/js/common/tests/shell-document.js \
@srcdir@/js/common/tests/shell-edge.js \
@srcdir@/js/common/tests/shell-collection.js \
@srcdir@/js/common/tests/shell-index.js \
@srcdir@/js/common/tests/shell-index-geo.js
UNITTESTS_SERVER = $(addprefix --unit-tests ,$(SHELL_SERVER))
@ -1029,10 +1030,10 @@ UNITTESTS_SERVER = $(addprefix --unit-tests ,$(SHELL_SERVER))
################################################################################
################################################################################
SHELL_SERVER_AHUACATL = @srcdir@/js/server/tests/ahuacatl-operators.js \
@srcdir@/js/server/tests/ahuacatl-escaping.js \
@srcdir@/js/server/tests/ahuacatl-functions.js \
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
@srcdir@/js/server/tests/ahuacatl-escaping.js \
@srcdir@/js/server/tests/ahuacatl-functions.js \
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
UNITTESTS_SERVER_AHUACATL = $(addprefix --unit-tests ,$(SHELL_SERVER_AHUACATL))
@ -1040,7 +1041,8 @@ UNITTESTS_SERVER_AHUACATL = $(addprefix --unit-tests ,$(SHELL_SERVER_AHUACATL))
################################################################################
SHELL_CLIENT = @srcdir@/js/common/tests/shell-document.js \
@srcdir@/js/common/tests/shell-edge.js \
@srcdir@/js/common/tests/shell-collection.js
@srcdir@/js/common/tests/shell-collection.js \
@srcdir@/js/common/tests/shell-index.js
UNITTESTS_CLIENT = $(addprefix --unit-tests ,$(SHELL_CLIENT))
@ENABLE_32BIT_TRUE@@ENABLE_ALL_IN_ONE_TRUE@LIBEV_BUILD_VERSION = ARCH.ia32

View File

@ -130,6 +130,7 @@ endif
SHELL_SERVER = @srcdir@/js/common/tests/shell-document.js \
@srcdir@/js/common/tests/shell-edge.js \
@srcdir@/js/common/tests/shell-collection.js \
@srcdir@/js/common/tests/shell-index.js \
@srcdir@/js/common/tests/shell-index-geo.js
.PHONY: unittests-shell-server
@ -157,10 +158,10 @@ unittests-shell-server:
################################################################################
SHELL_SERVER_AHUACATL = @srcdir@/js/server/tests/ahuacatl-operators.js \
@srcdir@/js/server/tests/ahuacatl-escaping.js \
@srcdir@/js/server/tests/ahuacatl-functions.js \
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
@srcdir@/js/server/tests/ahuacatl-escaping.js \
@srcdir@/js/server/tests/ahuacatl-functions.js \
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js
.PHONY: unittests-shell-server-ahuacatl
@ -189,7 +190,8 @@ unittests-shell-server-ahuacatl:
SHELL_CLIENT = @srcdir@/js/common/tests/shell-document.js \
@srcdir@/js/common/tests/shell-edge.js \
@srcdir@/js/common/tests/shell-collection.js
@srcdir@/js/common/tests/shell-collection.js \
@srcdir@/js/common/tests/shell-index.js
.PHONY: unittests-shell-client

View File

@ -1122,7 +1122,7 @@ AvocadoCollection.prototype.getIndexes = function () {
TRI_CheckRequestResult(requestResult);
return requestResult;
return requestResult.indexes;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -43,7 +43,7 @@ var jsunity = require("jsunity");
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: Graph Creation
/// @brief test suite: Creation
////////////////////////////////////////////////////////////////////////////////
function geoIndexCreationSuite() {

View File

@ -0,0 +1,153 @@
/*jslint indent: 2,
nomen: true,
maxlen: 80 */
/*global require,
db,
assertEqual, assertTrue,
print,
PRINT_OBJECT,
console,
AvocadoCollection, AvocadoEdgesCollection */
////////////////////////////////////////////////////////////////////////////////
/// @brief test the index
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler, Lucas Dohmen
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var jsunity = require("jsunity");
// -----------------------------------------------------------------------------
// --SECTION-- basic methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: basics
////////////////////////////////////////////////////////////////////////////////
function indexSuite() {
var cn = "UnitTestsCollectionIdx";
var collection = null;
return {
////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
internal.db._drop(cn);
collection = internal.db._create(cn, { waitForSync : false });
},
////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
collection.drop();
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: get indexes
////////////////////////////////////////////////////////////////////////////////
testGetIndexes : function () {
var res = collection.getIndexes();
assertEqual(1, res.length);
collection.ensureGeoIndex("a");
collection.ensureGeoIndex("a", "b");
res = collection.getIndexes();
assertEqual(3, res.length);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test: get index
////////////////////////////////////////////////////////////////////////////////
testIndex : function () {
var id = collection.ensureGeoIndex("a");
var idx = collection.index(id.id);
assertEqual(id.id, idx.id);
idx = collection.index(id);
assertEqual(id.id, idx.id);
idx = internal.db._index(id.id);
assertEqual(id.id, idx.id);
idx = internal.db._index(id);
assertEqual(id.id, idx.id);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief drop index
////////////////////////////////////////////////////////////////////////////////
testDropIndex : function () {
var id = collection.ensureGeoIndex("a");
var res = collection.dropIndex(id.id);
assertEqual(true, res);
res = collection.dropIndex(id.id);
assertEqual(false, res);
id = collection.ensureGeoIndex("a");
res = collection.dropIndex(id);
assertEqual(true, res);
res = collection.dropIndex(id);
assertEqual(false, res);
id = collection.ensureGeoIndex("a");
res = internal.db._dropIndex(id);
assertEqual(true, res);
res = internal.db._dropIndex(id);
assertEqual(false, res);
}
};
}
// -----------------------------------------------------------------------------
// --SECTION-- main
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suites
////////////////////////////////////////////////////////////////////////////////
jsunity.run(indexSuite);
return jsunity.done();
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End: