feat: Add new calculator batches (6-10) and associated deployment/verification scripts, and update the calculator list.
This commit is contained in:
47
verify_batch_7.py
Normal file
47
verify_batch_7.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import urllib.request
|
||||
import json
|
||||
import re
|
||||
|
||||
batch_7_results = [
|
||||
{"url": "https://howdoyouconvert.com/calculator/centigrams-to-grams/?ao_noptimize=1", "v1": 100, "expected_v2": 1, "m": 0.01},
|
||||
{"url": "https://howdoyouconvert.com/calculator/centiliters-to-liters/?ao_noptimize=1", "v1": 100, "expected_v2": 1, "m": 0.01},
|
||||
{"url": "https://howdoyouconvert.com/calculator/centimeters-to-feet/?ao_noptimize=1", "v1": 30.48, "expected_v2": 0.99999999, "m": 0.032808399},
|
||||
{"url": "https://howdoyouconvert.com/calculator/centimeters-to-meters/?ao_noptimize=1", "v1": 100, "expected_v2": 1, "m": 0.01},
|
||||
{"url": "https://howdoyouconvert.com/calculator/centimeters-to-millimeters/?ao_noptimize=1", "v1": 1, "expected_v2": 10, "m": 10.0},
|
||||
{"url": "https://howdoyouconvert.com/calculator/chains-to-feet/?ao_noptimize=1", "v1": 1, "expected_v2": 66, "m": 66.0},
|
||||
{"url": "https://howdoyouconvert.com/calculator/chains-to-meters/?ao_noptimize=1", "v1": 1, "expected_v2": 20.1168, "m": 20.1168},
|
||||
{"url": "https://howdoyouconvert.com/calculator/cubic-centimeters-to-cubic-inches/?ao_noptimize=1", "v1": 16.387064, "expected_v2": 1, "m": 0.0610237441},
|
||||
{"url": "https://howdoyouconvert.com/calculator/cubic-feet-to-cubic-meters/?ao_noptimize=1", "v1": 35.3146667, "expected_v2": 1, "m": 0.0283168466},
|
||||
{"url": "https://howdoyouconvert.com/calculator/cubic-meters-to-liters/?ao_noptimize=1", "v1": 1, "expected_v2": 1000, "m": 1000.0}
|
||||
]
|
||||
|
||||
headers = {"User-Agent": "Mozilla/5.0"}
|
||||
|
||||
for calc in batch_7_results:
|
||||
print(f"\n--- Verifying {calc['url']} ---")
|
||||
req = urllib.request.Request(calc['url'], headers=headers)
|
||||
try:
|
||||
resp = urllib.request.urlopen(req, timeout=30).read().decode("utf-8")
|
||||
|
||||
# Check for robust JS
|
||||
if "initRetries" in resp and "setTimeout(init, 100)" in resp:
|
||||
print("Robust JS: OK")
|
||||
else:
|
||||
print("Robust JS: MISSING")
|
||||
|
||||
# Extract multiplier
|
||||
m = re.search(r'v \* ([\d\.]+)', resp)
|
||||
if m:
|
||||
actual_m = float(m.group(1))
|
||||
print(f"Multiplier: {actual_m} (Expected {calc['m']})")
|
||||
if abs(actual_m - calc['m']) < 0.0000001:
|
||||
print("Math Match: OK")
|
||||
else:
|
||||
print("Math Match: FAIL")
|
||||
else:
|
||||
print("Multiplier: NOT FOUND")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
print("\nVERIFICATION COMPLETE")
|
||||
Reference in New Issue
Block a user