Ver código fonte

Add randomizing test script

master
Pete Shadbolt 6 anos atrás
pai
commit
9f0b46c7dc
2 arquivos alterados com 33 adições e 3 exclusões
  1. +28
    -0
      randomize.py
  2. +5
    -3
      test.py

+ 28
- 0
randomize.py Ver arquivo

@@ -0,0 +1,28 @@
"""
Makes a dummy post to the test server
"""
import requests
import json
import abp
import random
import time

#URL = "http://localhost:5000"
URL = "https://abv.peteshadbolt.co.uk/"

def test_graph():
N = 50
g = abp.NXGraphState(range(N))

for i in range(N):
g.act_cz(random.randint(0, N-1), random.randint(0, N-1))

g.layout()
return g

if __name__ == '__main__':
while True:
data = json.dumps(test_graph().to_json(stringify=False))
r = requests.post("{}/graph".format(URL), data=data)
time.sleep(5)


+ 5
- 3
test.py Ver arquivo

@@ -4,16 +4,18 @@ Makes a dummy post to the test server
import requests
import json
import abp
import random

#URL = "http://localhost:5000"
URL = "https://abv.peteshadbolt.co.uk/"

def test_graph():
N = 100
N = 50
g = abp.NXGraphState(range(N))

for i in range(N-1):
g.act_cz(i, i+1)
for i in range(N):
g.act_cz(random.randint(0, N-1), random.randint(0, N-1))

g.layout()
return g



Carregando…
Cancelar
Salvar