Phase is not linear in frequency domain after delay in time domain When impulse response is symmetric around sample zero phase entirely zero. 

in = 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 , 0 -> This gives zero phase result 

As I know if I apply a delay in time domain this should result a linear phase in frequency domain. So if I delay my previous vector by one;

in = 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 -> This should give linear phase responce

const int N = 11;

// in = 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 0 , 0 
std::vector&lt; std::complex&lt;double&gt; &gt; in (N);
std::vector&lt; std::complex&lt;double&gt; &gt; out (N);
std::vector&lt; std::complex&lt;double&gt; &gt; polarOut (N);

auto middleElem = in.begin() + in.size()/2;
//std::fill( middleElem - 1, middleElem + 3, 1); //zero phase
std::fill( middleElem, middleElem + 4, 1);

fftw_plan my_plan  = fftw_plan_dft_1d(N, reinterpret_cast&lt;fftw_complex*&gt;(&amp;in[0]),
                                         reinterpret_cast&lt;fftw_complex*&gt;(&amp;out[0]), FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(my_plan);

std::transform( out.begin(), out.end(), polarOut.begin(),
                []( auto&amp; in ){
                                return  std::complex&lt;double&gt;( std::abs(in), std::arg(in) );
                              } );


The result of the fourier transform in polar notation is : 

    polarOut    &lt;11 items&gt;  std::vector&lt;std::complex&lt;double&gt;&gt;
        [0] (4.000000, 0.000000)    std::complex&lt;double&gt;
        [1] (3.228707, 2.570394)    std::complex&lt;double&gt;
        [2] (1.397877, -1.142397)   std::complex&lt;double&gt;
        [3] (0.372786, -1.713596)   std::complex&lt;double&gt;
        [4] (1.088156, 0.856798)    std::complex&lt;double&gt;
        [5] (0.546200, -2.855993)   std::complex&lt;double&gt;
        [6] (0.546200, 2.855993)    std::complex&lt;double&gt;
        [7] (1.088156, -0.856798)   std::complex&lt;double&gt;
        [8] (0.372786, 1.713596)    std::complex&lt;double&gt;
        [9] (1.397877, 1.142397)    std::complex&lt;double&gt;
        [10]    (3.228707, -2.570394)   std::complex&lt;double&gt;


What am I missing here? Why phase responce is not linearly increasing?
The phase is in fact linear, apart from jumps of $\pi$ at the zeros of the magnitude. There are two reasons why you don't see it:


the phase you compute is the principal value, which is in $(-\pi,\pi]$. Note that you can always add or subtract a multiple of $2\pi$ to the phase without changing anything. Removing these artificial jumps due to the principal value is called phase unwrapping.
you only compute very few points, and due to point 1 above you just see an erratic behavior.


Solution:


compute a more detailed DFT (by zero-padding the original signal)
unwrap the phase (if you have Matlab/Octave, there's a command to do that)


Here an example in Matlab/Octave:


x = [0 0 0 0 0 1 1 1 1 0 0];
X = fft(x,512);         % length 512 FFT
ph = arg(X);            % wrapped phase
phu = unwrap(ph);       % unwrapped phase
plot((0:256),phu(1:257)/pi), grid on