Permalink
Browse files

add memory leak test for all classes

  • Loading branch information...
1 parent 4dff77c commit 1e28fec818e817a428b8d279e3ebe34ca4847889 kuno committed Dec 22, 2012
Showing with 78 additions and 4 deletions.
  1. +78 −4 test/memory_leak.js
View
@@ -3,10 +3,84 @@
var path = require('path');
var geoip = require(path.resolve(__dirname, '../index'));
-var file = path.resolve(__dirname, '../database/GeoLiteCity.dat');
+// City
+var city_db = path.resolve(__dirname, '../database/GeoLiteCity.dat');
+
+var city = new geoip.City(city_db);
+
+console.log(city.lookupSync('8.8.8.8'));
+
+city.lookup('8.8.8.8', function(err, data) {
+ console.log(data);
+});
+
+// City6
+var city6_db = path.resolve(__dirname, '../database/GeoLiteCityv6.dat');
+
+var city6 = new geoip.City6(city6_db);
+
+console.log(city6.lookupSync('2406:a000:f0ff:fffe::122d'));
+
+city6.lookup('2406:a000:f0ff:fffe::122d', function(err, data) {
+ console.log(data);
+});
+
+// Country
+var country_db = path.resolve(__dirname, '../database/GeoIP.dat');
+
+var country = new geoip.Country(country_db);
+
+console.log(country.lookupSync('8.8.8.8'));
+
+country.lookup('8.8.8.8', function(err, data) {
+ console.log(data);
+});
+
+// Country6
+var country6_db = path.resolve(__dirname, '../database/GeoIPv6.dat');
+
+var country6 = new geoip.Country6(country6_db);
+
+console.log(country6.lookupSync('2406:a000:f0ff:fffe::122d'));
+
+country6.lookup('2406:a000:f0ff:fffe::122d', function(err, data) {
+ console.log(data);
+});
+
+// Netspeed
+var netspeed_db = path.resolve(__dirname, '../database/GeoIP-171_20040418.dat');
+
+var netspeed = new geoip.NetSpeed(netspeed_db);
+
+console.log(netspeed.lookupSync('8.8.8.8'));
+
+netspeed.lookup('8.8.8.8.', function(err, data) {
+ console.log(data);
+});
+
+// org
+var org_db = path.resolve(__dirname, '../database/GeoIPASNum.dat');
+
+var org = new geoip.Org(org_db);
+
+console.log(org.lookupSync('8.8.8.8'));
+
+org.lookup('8.8.8.8', function(err, data) {
+ console.log(data);
+});
+
+// region
+var region_db = path.resolve(__dirname, '../database/GeoIPRegion-515.dat');
+
+var region = new geoip.Region(region_db);
+
+console.log(region.lookupSync('8.8.8.8'));
+
+region.lookup('8.8.8.8', function(err, data) {
+ console.log(data);
+});
+
+
-console.log(file);
-var city = new geoip.City(file);
-console.log(city.lookupSync('8.8.8.8'));

0 comments on commit 1e28fec

Please sign in to comment.