blob: 595d037f32a009c59364fb05409f6b46516d4a33 [file] [log] [blame]
Yi Huang3d230672014-04-26 04:25:24 -07001#!/usr/bin/python2
2# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
3#
4# Copyright (C) 2014 University of Arizona
5# Author: Yi Huang <ltr120@email.arizona.edu>
6# See COPYING for copyright and distribution information.
7#
8
9import os
10import unittest
11import subprocess
12
13class test_interest_loop(unittest.TestCase):
14 """Test case for Interest loop scenario"""
15
16 errormsg = {
17 1 : "Counter for incoming interest is greater than 200.",
18 2 : "Counter for outgoing interest is greater than 200.",
19 }
20
21 def setUp(self):
22 print "\nTesting Interest loop scenario"
23 print "******************************"
24 os.chdir("test_interest_loop")
25
26 def tearDown(self):
27 print "******************************"
28 os.chdir("..")
29
30 def test_broadcast(self):
31 print ">>> Testing with Broadcast Strategy <<<"
32 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/broadcast"], shell=True)
33 print "Test script return value:", ret
34 if ret != 0:
35 self.fail(self.errormsg[ret])
36
37 def test_best_route(self):
38 print ">>> Testing with Best-route Strategy <<<"
39 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/best-route"], shell=True)
40 print "Test script return value:", ret
41 if ret != 0:
42 self.fail(self.errormsg[ret])
43
44 def test_client_control(self):
45 print ">>> Testing with Client Control Strategy <<<"
46 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/client-control"], shell=True)
47 print "Test script return value:", ret
48 if ret != 0:
49 self.fail(self.errormsg[ret])
50
51 def test_ncc(self):
52 print ">>> Testing with NCC Strategy <<<"
53 ret = subprocess.call(["./interest-loop-test.sh ndn:/localhost/nfd/strategy/ncc"], shell=True)
54 print "Test script return value:", ret
55 if ret != 0:
56 self.fail(self.errormsg[ret])