平台debug(代码数据比对)

提前下载好数据,并修改data_pre,出现问题可以到文本比对 进行比对

比对Python代码

import os
data_pre='data'

def save(id):
    while True:
        import os
        if os.path.exists('std.py'):
            os.system('python3 -u test.py < '+data_pre+str(id)+'.in'+' > '+ data_pre +str(id)+'.out1')
        else:
            os.system('g++-9 test.cpp -Wall -std=c++14 -o test')
            os.system('./test < '+data_pre+str(id)+'.in'+' > '+ data_pre +str(id)+'.out1')

        fp_in=open(data_pre+str(id)+'.out')
        fp_check=open(data_pre+str(id)+'.out1')
        content1=fp_in.read().rstrip().split('\n')
        content2=fp_check.read().rstrip().split('\n')
        if content1!=content2:
            print(f'data{id}数据出错')
            return
        break
    os.remove(data_pre+str(id)+'.out1')

if __name__ == "__main__":
    for i in range(0,10):
        save(i)

比对网站

https://bobhuang.xyz/diff

posted @ 2022-02-06 21:43  暴力都不会的蒟蒻  阅读(88)  评论(0编辑  收藏  举报