小编Ore*_*tis的帖子

测试在单独运行时通过,但在整个测试类运行时未通过

我已经解决了topCoder问题,当我自己运行它们时,所有测试都通过了。尽管如此,当我运行整个测试类时,其中一些还是失败了。您能帮我确定这种现象的原因吗?这是我的课程和测试:

 package com.topcoder.div2.stage1;

import java.util.Arrays;

public class GameOfStones {
    private int iterations = 0;
    public int count(int[] stones){
        int result = checkEquality(stones);
        return result;
    }

    private int checkEquality(int[] stones){
        int count = 0;
        int sum = 0;
        for(int k = 0; k< stones.length;k++){
            sum += stones[k];
        }
        if(stones.length > 0) {
            for (int i = 0; i < sum; i++) {
                Arrays.sort(stones);
                if(stones[stones.length-1] != 3) {
                    int j = 0;
                    while (j < stones.length - 1) {
                        if (stones[j] == …
Run Code Online (Sandbox Code Playgroud)

java algorithm testng

8
推荐指数
1
解决办法
7768
查看次数

如何使用 Haskell 的 Network.HTTP.Req 库执行 GET?

我正在尝试执行一个简单的 HTTP GET 请求,但返回 404。我认为 URL 存在问题,但我找不到它。

这是执行请求的函数:

getMockResource :: (MonadHttp m) =>  m BsResponse 
getMockResource = req
  GET
  (http "www.mocky.io" /: "/v2/5da208d92f00007900f418ff")
  NoReqBody
  bsResponse
  mempty
Run Code Online (Sandbox Code Playgroud)

我的主要:

main :: IO ()
main = runReq defaultHttpConfig $ do
  r <- getMockResource
  liftIO $ B.putStrLn (responseBody r)
Run Code Online (Sandbox Code Playgroud)

这是输出:

VanillaHttpException (HttpExceptionRequest Request {
  host                 = "www.mocky.io"
  port                 = 80
  secure               = False
  requestHeaders       = []
  path                 = "/%2Fv2%2F5da208d92f00007900f418ff"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10 …
Run Code Online (Sandbox Code Playgroud)

haskell http

5
推荐指数
1
解决办法
526
查看次数

标签 统计

algorithm ×1

haskell ×1

http ×1

java ×1

testng ×1