/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

TEST_DECLARE   (platform_output)
TEST_DECLARE   (callback_order)
TEST_DECLARE   (close_order)
TEST_DECLARE   (run_once)
TEST_DECLARE   (run_nowait)
TEST_DECLARE   (loop_alive)
TEST_DECLARE   (loop_close)
TEST_DECLARE   (loop_stop)
TEST_DECLARE   (loop_update_time)
TEST_DECLARE   (loop_backend_timeout)
TEST_DECLARE   (loop_configure)
TEST_DECLARE   (default_loop_close)
TEST_DECLARE   (barrier_1)
TEST_DECLARE   (barrier_2)
TEST_DECLARE   (barrier_3)
TEST_DECLARE   (condvar_1)
TEST_DECLARE   (condvar_2)
TEST_DECLARE   (condvar_3)
TEST_DECLARE   (condvar_4)
TEST_DECLARE   (condvar_5)
TEST_DECLARE   (semaphore_1)
TEST_DECLARE   (semaphore_2)
TEST_DECLARE   (semaphore_3)
TEST_DECLARE   (tty)
TEST_DECLARE   (stdio_over_pipes)
TEST_DECLARE   (ip6_pton)
TEST_DECLARE   (ipc_listen_before_write)
TEST_DECLARE   (ipc_listen_after_write)
#ifndef _WIN32
TEST_DECLARE   (ipc_send_recv_pipe)
#endif
TEST_DECLARE   (ipc_send_recv_tcp)
TEST_DECLARE   (ipc_tcp_connection)
TEST_DECLARE   (tcp_ping_pong)
TEST_DECLARE   (tcp_ping_pong_v6)
TEST_DECLARE   (pipe_ping_pong)
TEST_DECLARE   (delayed_accept)
TEST_DECLARE   (multiple_listen)
#ifndef _WIN32
TEST_DECLARE   (tcp_write_after_connect)
#endif
TEST_DECLARE   (tcp_writealot)
TEST_DECLARE   (tcp_try_write)
TEST_DECLARE   (tcp_write_queue_order)
TEST_DECLARE   (tcp_open)
TEST_DECLARE   (tcp_connect_error_after_write)
TEST_DECLARE   (tcp_shutdown_after_write)
TEST_DECLARE   (tcp_bind_error_addrinuse)
TEST_DECLARE   (tcp_bind_error_addrnotavail_1)
TEST_DECLARE   (tcp_bind_error_addrnotavail_2)
TEST_DECLARE   (tcp_bind_error_fault)
TEST_DECLARE   (tcp_bind_error_inval)
TEST_DECLARE   (tcp_bind_localhost_ok)
TEST_DECLARE   (tcp_bind_invalid_flags)
TEST_DECLARE   (tcp_listen_without_bind)
TEST_DECLARE   (tcp_connect_error_fault)
TEST_DECLARE   (tcp_connect_timeout)
TEST_DECLARE   (tcp_close_while_connecting)
TEST_DECLARE   (tcp_close)
#ifndef _WIN32
TEST_DECLARE   (tcp_close_accept)
TEST_DECLARE   (tcp_oob)
#endif
TEST_DECLARE   (tcp_flags)
TEST_DECLARE   (tcp_write_to_half_open_connection)
TEST_DECLARE   (tcp_unexpected_read)
TEST_DECLARE   (tcp_read_stop)
TEST_DECLARE   (tcp_bind6_error_addrinuse)
TEST_DECLARE   (tcp_bind6_error_addrnotavail)
TEST_DECLARE   (tcp_bind6_error_fault)
TEST_DECLARE   (tcp_bind6_error_inval)
TEST_DECLARE   (tcp_bind6_localhost_ok)
TEST_DECLARE   (udp_bind)
TEST_DECLARE   (udp_bind_reuseaddr)
TEST_DECLARE   (udp_send_and_recv)
TEST_DECLARE   (udp_send_immediate)
TEST_DECLARE   (udp_send_unreachable)
TEST_DECLARE   (udp_multicast_join)
TEST_DECLARE   (udp_multicast_join6)
TEST_DECLARE   (udp_multicast_ttl)
TEST_DECLARE   (udp_multicast_interface)
TEST_DECLARE   (udp_multicast_interface6)
TEST_DECLARE   (udp_dgram_too_big)
TEST_DECLARE   (udp_dual_stack)
TEST_DECLARE   (udp_ipv6_only)
TEST_DECLARE   (udp_options)
TEST_DECLARE   (udp_options6)
TEST_DECLARE   (udp_no_autobind)
TEST_DECLARE   (udp_open)
TEST_DECLARE   (udp_try_send)
TEST_DECLARE   (pipe_bind_error_addrinuse)
TEST_DECLARE   (pipe_bind_error_addrnotavail)
TEST_DECLARE   (pipe_bind_error_inval)
TEST_DECLARE   (pipe_listen_without_bind)
TEST_DECLARE   (pipe_connect_bad_name)
TEST_DECLARE   (pipe_connect_to_file)
TEST_DECLARE   (pipe_getsockname)
TEST_DECLARE   (pipe_getsockname_abstract)
TEST_DECLARE   (pipe_getsockname_blocking)
TEST_DECLARE   (pipe_sendmsg)
TEST_DECLARE   (pipe_server_close)
TEST_DECLARE   (connection_fail)
TEST_DECLARE   (connection_fail_doesnt_auto_close)
TEST_DECLARE   (shutdown_close_tcp)
TEST_DECLARE   (shutdown_close_pipe)
TEST_DECLARE   (shutdown_eof)
TEST_DECLARE   (shutdown_twice)
TEST_DECLARE   (callback_stack)
TEST_DECLARE   (error_message)
TEST_DECLARE   (timer)
TEST_DECLARE   (timer_init)
TEST_DECLARE   (timer_again)
TEST_DECLARE   (timer_start_twice)
TEST_DECLARE   (timer_order)
TEST_DECLARE   (timer_huge_timeout)
TEST_DECLARE   (timer_huge_repeat)
TEST_DECLARE   (timer_run_once)
TEST_DECLARE   (timer_from_check)
TEST_DECLARE   (timer_null_callback)
TEST_DECLARE   (idle_starvation)
TEST_DECLARE   (loop_handles)
TEST_DECLARE   (get_loadavg)
TEST_DECLARE   (walk_handles)
TEST_DECLARE   (watcher_cross_stop)
TEST_DECLARE   (ref)
TEST_DECLARE   (idle_ref)
TEST_DECLARE   (async_ref)
TEST_DECLARE   (prepare_ref)
TEST_DECLARE   (check_ref)
TEST_DECLARE   (unref_in_prepare_cb)
TEST_DECLARE   (timer_ref)
TEST_DECLARE   (timer_ref2)
TEST_DECLARE   (fs_event_ref)
TEST_DECLARE   (fs_poll_ref)
TEST_DECLARE   (tcp_ref)
TEST_DECLARE   (tcp_ref2)
TEST_DECLARE   (tcp_ref2b)
TEST_DECLARE   (tcp_ref3)
TEST_DECLARE   (tcp_ref4)
TEST_DECLARE   (udp_ref)
TEST_DECLARE   (udp_ref2)
TEST_DECLARE   (udp_ref3)
TEST_DECLARE   (pipe_ref)
TEST_DECLARE   (pipe_ref2)
TEST_DECLARE   (pipe_ref3)
TEST_DECLARE   (pipe_ref4)
#ifndef _WIN32
TEST_DECLARE   (pipe_close_stdout_read_stdin)
#endif
TEST_DECLARE   (pipe_set_non_blocking)
TEST_DECLARE   (process_ref)
TEST_DECLARE   (has_ref)
TEST_DECLARE   (active)
TEST_DECLARE   (embed)
TEST_DECLARE   (async)
TEST_DECLARE   (async_null_cb)
TEST_DECLARE   (get_currentexe)
TEST_DECLARE   (process_title)
TEST_DECLARE   (cwd_and_chdir)
TEST_DECLARE   (get_memory)
TEST_DECLARE   (handle_fileno)
TEST_DECLARE   (hrtime)
TEST_DECLARE   (getaddrinfo_fail)
TEST_DECLARE   (getaddrinfo_fail_sync)
TEST_DECLARE   (getaddrinfo_basic)
TEST_DECLARE   (getaddrinfo_basic_sync)
TEST_DECLARE   (getaddrinfo_concurrent)
TEST_DECLARE   (getnameinfo_basic_ip4)
TEST_DECLARE   (getnameinfo_basic_ip4_sync)
TEST_DECLARE   (getnameinfo_basic_ip6)
TEST_DECLARE   (getsockname_tcp)
TEST_DECLARE   (getsockname_udp)
TEST_DECLARE   (fail_always)
TEST_DECLARE   (pass_always)
TEST_DECLARE   (socket_buffer_size)
TEST_DECLARE   (spawn_fails)
TEST_DECLARE   (spawn_exit_code)
TEST_DECLARE   (spawn_stdout)
TEST_DECLARE   (spawn_stdin)
TEST_DECLARE   (spawn_stdio_greater_than_3)
TEST_DECLARE   (spawn_ignored_stdio)
TEST_DECLARE   (spawn_and_kill)
TEST_DECLARE   (spawn_detached)
TEST_DECLARE   (spawn_and_kill_with_std)
TEST_DECLARE   (spawn_and_ping)
TEST_DECLARE   (spawn_preserve_env)
TEST_DECLARE   (spawn_setuid_fails)
TEST_DECLARE   (spawn_setgid_fails)
TEST_DECLARE   (spawn_stdout_to_file)
TEST_DECLARE   (spawn_stdout_and_stderr_to_file)
TEST_DECLARE   (spawn_auto_unref)
TEST_DECLARE   (spawn_closed_process_io)
TEST_DECLARE   (spawn_reads_child_path)
TEST_DECLARE   (fs_poll)
TEST_DECLARE   (fs_poll_getpath)
TEST_DECLARE   (kill)
TEST_DECLARE   (fs_file_noent)
TEST_DECLARE   (fs_file_nametoolong)
TEST_DECLARE   (fs_file_loop)
TEST_DECLARE   (fs_file_async)
TEST_DECLARE   (fs_file_sync)
TEST_DECLARE   (fs_file_write_null_buffer)
TEST_DECLARE   (fs_async_dir)
TEST_DECLARE   (fs_async_sendfile)
TEST_DECLARE   (fs_mkdtemp)
TEST_DECLARE   (fs_fstat)
TEST_DECLARE   (fs_access)
TEST_DECLARE   (fs_chmod)
TEST_DECLARE   (fs_chown)
TEST_DECLARE   (fs_link)
TEST_DECLARE   (fs_readlink)
TEST_DECLARE   (fs_symlink)
TEST_DECLARE   (fs_symlink_dir)
TEST_DECLARE   (fs_utime)
TEST_DECLARE   (fs_futime)
TEST_DECLARE   (fs_file_open_append)
TEST_DECLARE   (fs_stat_missing_path)
TEST_DECLARE   (fs_read_file_eof)
TEST_DECLARE   (fs_event_watch_dir)
TEST_DECLARE   (fs_event_watch_file)
TEST_DECLARE   (fs_event_watch_file_twice)
TEST_DECLARE   (fs_event_watch_file_current_dir)
TEST_DECLARE   (fs_event_no_callback_after_close)
TEST_DECLARE   (fs_event_no_callback_on_close)
TEST_DECLARE   (fs_event_immediate_close)
TEST_DECLARE   (fs_event_close_with_pending_event)
TEST_DECLARE   (fs_event_close_in_callback)
TEST_DECLARE   (fs_event_start_and_close)
TEST_DECLARE   (fs_event_error_reporting)
TEST_DECLARE   (fs_event_getpath)
TEST_DECLARE   (fs_scandir_empty_dir)
TEST_DECLARE   (fs_scandir_file)
TEST_DECLARE   (fs_open_dir)
TEST_DECLARE   (fs_rename_to_existing_file)
TEST_DECLARE   (fs_write_multiple_bufs)
TEST_DECLARE   (threadpool_queue_work_simple)
TEST_DECLARE   (threadpool_queue_work_einval)
TEST_DECLARE   (threadpool_multiple_event_loops)
TEST_DECLARE   (threadpool_cancel_getaddrinfo)
TEST_DECLARE   (threadpool_cancel_getnameinfo)
TEST_DECLARE   (threadpool_cancel_work)
TEST_DECLARE   (threadpool_cancel_fs)
TEST_DECLARE   (threadpool_cancel_single)
TEST_DECLARE   (thread_local_storage)
TEST_DECLARE   (thread_mutex)
TEST_DECLARE   (thread_rwlock)
TEST_DECLARE   (thread_create)
TEST_DECLARE   (thread_equal)
TEST_DECLARE   (dlerror)
TEST_DECLARE   (poll_duplex)
TEST_DECLARE   (poll_unidirectional)
TEST_DECLARE   (poll_close)

TEST_DECLARE   (ip4_addr)
TEST_DECLARE   (ip6_addr_link_local)

#ifdef _WIN32
TEST_DECLARE   (poll_close_doesnt_corrupt_stack)
TEST_DECLARE   (poll_closesocket)
TEST_DECLARE   (spawn_detect_pipe_name_collisions_on_windows)
TEST_DECLARE   (argument_escaping)
TEST_DECLARE   (environment_creation)
TEST_DECLARE   (listen_with_simultaneous_accepts)
TEST_DECLARE   (listen_no_simultaneous_accepts)
TEST_DECLARE   (fs_stat_root)
TEST_DECLARE   (spawn_with_an_odd_path)
TEST_DECLARE   (ipc_listen_after_bind_twice)
#else
TEST_DECLARE   (emfile)
TEST_DECLARE   (close_fd)
TEST_DECLARE   (spawn_fs_open)
TEST_DECLARE   (spawn_setuid_setgid)
TEST_DECLARE   (we_get_signal)
TEST_DECLARE   (we_get_signals)
TEST_DECLARE   (signal_multiple_loops)
TEST_DECLARE   (closed_fd_events)
#endif
#ifdef __APPLE__
TEST_DECLARE   (osx_select)
TEST_DECLARE   (osx_select_many_fds)
#endif
HELPER_DECLARE (tcp4_echo_server)
HELPER_DECLARE (tcp6_echo_server)
HELPER_DECLARE (udp4_echo_server)
HELPER_DECLARE (pipe_echo_server)

TASK_LIST_START
  TEST_ENTRY_CUSTOM (platform_output, 0, 1, 5000)

#if 0
  TEST_ENTRY  (callback_order)
#endif
  TEST_ENTRY  (close_order)
  TEST_ENTRY  (run_once)
  TEST_ENTRY  (run_nowait)
  TEST_ENTRY  (loop_alive)
  TEST_ENTRY  (loop_close)
  TEST_ENTRY  (loop_stop)
  TEST_ENTRY  (loop_update_time)
  TEST_ENTRY  (loop_backend_timeout)
  TEST_ENTRY  (loop_configure)
  TEST_ENTRY  (default_loop_close)
  TEST_ENTRY  (barrier_1)
  TEST_ENTRY  (barrier_2)
  TEST_ENTRY  (barrier_3)
  TEST_ENTRY  (condvar_1)
  TEST_ENTRY  (condvar_2)
  TEST_ENTRY  (condvar_3)
  TEST_ENTRY  (condvar_4)
  TEST_ENTRY  (condvar_5)
  TEST_ENTRY  (semaphore_1)
  TEST_ENTRY  (semaphore_2)
  TEST_ENTRY  (semaphore_3)

  TEST_ENTRY  (pipe_connect_bad_name)
  TEST_ENTRY  (pipe_connect_to_file)

  TEST_ENTRY  (pipe_server_close)
#ifndef _WIN32
  TEST_ENTRY  (pipe_close_stdout_read_stdin)
#endif
  TEST_ENTRY  (pipe_set_non_blocking)
  TEST_ENTRY  (tty)
  TEST_ENTRY  (stdio_over_pipes)
  TEST_ENTRY  (ip6_pton)
  TEST_ENTRY  (ipc_listen_before_write)
  TEST_ENTRY  (ipc_listen_after_write)
#ifndef _WIN32
  TEST_ENTRY  (ipc_send_recv_pipe)
#endif
  TEST_ENTRY  (ipc_send_recv_tcp)
  TEST_ENTRY  (ipc_tcp_connection)

  TEST_ENTRY  (tcp_ping_pong)
  TEST_HELPER (tcp_ping_pong, tcp4_echo_server)

  TEST_ENTRY  (tcp_ping_pong_v6)
  TEST_HELPER (tcp_ping_pong_v6, tcp6_echo_server)

  TEST_ENTRY  (pipe_ping_pong)
  TEST_HELPER (pipe_ping_pong, pipe_echo_server)

  TEST_ENTRY  (delayed_accept)
  TEST_ENTRY  (multiple_listen)

#ifndef _WIN32
  TEST_ENTRY  (tcp_write_after_connect)
#endif

  TEST_ENTRY  (tcp_writealot)
  TEST_HELPER (tcp_writealot, tcp4_echo_server)

  TEST_ENTRY  (tcp_try_write)

  TEST_ENTRY  (tcp_write_queue_order)

  TEST_ENTRY  (tcp_open)
  TEST_HELPER (tcp_open, tcp4_echo_server)

  TEST_ENTRY  (tcp_shutdown_after_write)
  TEST_HELPER (tcp_shutdown_after_write, tcp4_echo_server)

  TEST_ENTRY  (tcp_connect_error_after_write)
  TEST_ENTRY  (tcp_bind_error_addrinuse)
  TEST_ENTRY  (tcp_bind_error_addrnotavail_1)
  TEST_ENTRY  (tcp_bind_error_addrnotavail_2)
  TEST_ENTRY  (tcp_bind_error_fault)
  TEST_ENTRY  (tcp_bind_error_inval)
  TEST_ENTRY  (tcp_bind_localhost_ok)
  TEST_ENTRY  (tcp_bind_invalid_flags)
  TEST_ENTRY  (tcp_listen_without_bind)
  TEST_ENTRY  (tcp_connect_error_fault)
  TEST_ENTRY  (tcp_connect_timeout)
  TEST_ENTRY  (tcp_close_while_connecting)
  TEST_ENTRY  (tcp_close)
#ifndef _WIN32
  TEST_ENTRY  (tcp_close_accept)
  TEST_ENTRY  (tcp_oob)
#endif
  TEST_ENTRY  (tcp_flags)
  TEST_ENTRY  (tcp_write_to_half_open_connection)
  TEST_ENTRY  (tcp_unexpected_read)

  TEST_ENTRY  (tcp_read_stop)
  TEST_HELPER (tcp_read_stop, tcp4_echo_server)

  TEST_ENTRY  (tcp_bind6_error_addrinuse)
  TEST_ENTRY  (tcp_bind6_error_addrnotavail)
  TEST_ENTRY  (tcp_bind6_error_fault)
  TEST_ENTRY  (tcp_bind6_error_inval)
  TEST_ENTRY  (tcp_bind6_localhost_ok)

  TEST_ENTRY  (udp_bind)
  TEST_ENTRY  (udp_bind_reuseaddr)
  TEST_ENTRY  (udp_send_and_recv)
  TEST_ENTRY  (udp_send_immediate)
  TEST_ENTRY  (udp_send_unreachable)
  TEST_ENTRY  (udp_dgram_too_big)
  TEST_ENTRY  (udp_dual_stack)
  TEST_ENTRY  (udp_ipv6_only)
  TEST_ENTRY  (udp_options)
  TEST_ENTRY  (udp_options6)
  TEST_ENTRY  (udp_no_autobind)
  TEST_ENTRY  (udp_multicast_interface)
  TEST_ENTRY  (udp_multicast_interface6)
  TEST_ENTRY  (udp_multicast_join)
  TEST_ENTRY  (udp_multicast_join6)
  TEST_ENTRY  (udp_multicast_ttl)
  TEST_ENTRY  (udp_try_send)

  TEST_ENTRY  (udp_open)
  TEST_HELPER (udp_open, udp4_echo_server)

  TEST_ENTRY  (pipe_bind_error_addrinuse)
  TEST_ENTRY  (pipe_bind_error_addrnotavail)
  TEST_ENTRY  (pipe_bind_error_inval)
  TEST_ENTRY  (pipe_listen_without_bind)
  TEST_ENTRY  (pipe_getsockname)
  TEST_ENTRY  (pipe_getsockname_abstract)
  TEST_ENTRY  (pipe_getsockname_blocking)
  TEST_ENTRY  (pipe_sendmsg)

  TEST_ENTRY  (connection_fail)
  TEST_ENTRY  (connection_fail_doesnt_auto_close)

  TEST_ENTRY  (shutdown_close_tcp)
  TEST_HELPER (shutdown_close_tcp, tcp4_echo_server)
  TEST_ENTRY  (shutdown_close_pipe)
  TEST_HELPER (shutdown_close_pipe, pipe_echo_server)

  TEST_ENTRY  (shutdown_eof)
  TEST_HELPER (shutdown_eof, tcp4_echo_server)

  TEST_ENTRY  (shutdown_twice)
  TEST_HELPER (shutdown_twice, tcp4_echo_server)

  TEST_ENTRY  (callback_stack)
  TEST_HELPER (callback_stack, tcp4_echo_server)

  TEST_ENTRY  (error_message)

  TEST_ENTRY  (timer)
  TEST_ENTRY  (timer_init)
  TEST_ENTRY  (timer_again)
  TEST_ENTRY  (timer_start_twice)
  TEST_ENTRY  (timer_order)
  TEST_ENTRY  (timer_huge_timeout)
  TEST_ENTRY  (timer_huge_repeat)
  TEST_ENTRY  (timer_run_once)
  TEST_ENTRY  (timer_from_check)
  TEST_ENTRY  (timer_null_callback)

  TEST_ENTRY  (idle_starvation)

  TEST_ENTRY  (ref)
  TEST_ENTRY  (idle_ref)
  TEST_ENTRY  (fs_poll_ref)
  TEST_ENTRY  (async_ref)
  TEST_ENTRY  (prepare_ref)
  TEST_ENTRY  (check_ref)
  TEST_ENTRY  (unref_in_prepare_cb)
  TEST_ENTRY  (timer_ref)
  TEST_ENTRY  (timer_ref2)
  TEST_ENTRY  (fs_event_ref)
  TEST_ENTRY  (tcp_ref)
  TEST_ENTRY  (tcp_ref2)
  TEST_ENTRY  (tcp_ref2b)
  TEST_ENTRY  (tcp_ref3)
  TEST_HELPER (tcp_ref3, tcp4_echo_server)
  TEST_ENTRY  (tcp_ref4)
  TEST_HELPER (tcp_ref4, tcp4_echo_server)
  TEST_ENTRY  (udp_ref)
  TEST_ENTRY  (udp_ref2)
  TEST_ENTRY  (udp_ref3)
  TEST_HELPER (udp_ref3, udp4_echo_server)
  TEST_ENTRY  (pipe_ref)
  TEST_ENTRY  (pipe_ref2)
  TEST_ENTRY  (pipe_ref3)
  TEST_HELPER (pipe_ref3, pipe_echo_server)
  TEST_ENTRY  (pipe_ref4)
  TEST_HELPER (pipe_ref4, pipe_echo_server)
  TEST_ENTRY  (process_ref)
  TEST_ENTRY  (has_ref)

  TEST_ENTRY  (loop_handles)
  TEST_ENTRY  (walk_handles)

  TEST_ENTRY  (watcher_cross_stop)

  TEST_ENTRY  (active)

  TEST_ENTRY  (embed)

  TEST_ENTRY  (async)
  TEST_ENTRY  (async_null_cb)

  TEST_ENTRY  (get_currentexe)

  TEST_ENTRY  (process_title)

  TEST_ENTRY  (cwd_and_chdir)

  TEST_ENTRY  (get_memory)

  TEST_ENTRY  (get_loadavg)

  TEST_ENTRY  (handle_fileno)

  TEST_ENTRY  (hrtime)

  TEST_ENTRY_CUSTOM (getaddrinfo_fail, 0, 0, 10000)
  TEST_ENTRY  (getaddrinfo_fail_sync)

  TEST_ENTRY  (getaddrinfo_basic)
  TEST_ENTRY  (getaddrinfo_basic_sync)
  TEST_ENTRY  (getaddrinfo_concurrent)

  TEST_ENTRY  (getnameinfo_basic_ip4)
  TEST_ENTRY  (getnameinfo_basic_ip4_sync)
  TEST_ENTRY  (getnameinfo_basic_ip6)

  TEST_ENTRY  (getsockname_tcp)
  TEST_ENTRY  (getsockname_udp)

  TEST_ENTRY  (poll_duplex)
  TEST_ENTRY  (poll_unidirectional)
  TEST_ENTRY  (poll_close)

  TEST_ENTRY  (socket_buffer_size)

  TEST_ENTRY  (spawn_fails)
  TEST_ENTRY  (spawn_exit_code)
  TEST_ENTRY  (spawn_stdout)
  TEST_ENTRY  (spawn_stdin)
  TEST_ENTRY  (spawn_stdio_greater_than_3)
  TEST_ENTRY  (spawn_ignored_stdio)
  TEST_ENTRY  (spawn_and_kill)
  TEST_ENTRY  (spawn_detached)
  TEST_ENTRY  (spawn_and_kill_with_std)
  TEST_ENTRY  (spawn_and_ping)
  TEST_ENTRY  (spawn_preserve_env)
  TEST_ENTRY  (spawn_setuid_fails)
  TEST_ENTRY  (spawn_setgid_fails)
  TEST_ENTRY  (spawn_stdout_to_file)
  TEST_ENTRY  (spawn_stdout_and_stderr_to_file)
  TEST_ENTRY  (spawn_auto_unref)
  TEST_ENTRY  (spawn_closed_process_io)
  TEST_ENTRY  (spawn_reads_child_path)
  TEST_ENTRY  (fs_poll)
  TEST_ENTRY  (fs_poll_getpath)
  TEST_ENTRY  (kill)

#ifdef _WIN32
  TEST_ENTRY  (poll_close_doesnt_corrupt_stack)
  TEST_ENTRY  (poll_closesocket)
  TEST_ENTRY  (spawn_detect_pipe_name_collisions_on_windows)
  TEST_ENTRY  (argument_escaping)
  TEST_ENTRY  (environment_creation)
  TEST_ENTRY  (listen_with_simultaneous_accepts)
  TEST_ENTRY  (listen_no_simultaneous_accepts)
  TEST_ENTRY  (fs_stat_root)
  TEST_ENTRY  (spawn_with_an_odd_path)
  TEST_ENTRY  (ipc_listen_after_bind_twice)
#else
  TEST_ENTRY  (emfile)
  TEST_ENTRY  (close_fd)
  TEST_ENTRY  (spawn_fs_open)
  TEST_ENTRY  (spawn_setuid_setgid)
  TEST_ENTRY  (we_get_signal)
  TEST_ENTRY  (we_get_signals)
  TEST_ENTRY  (signal_multiple_loops)
  TEST_ENTRY  (closed_fd_events)
#endif

#ifdef __APPLE__
  TEST_ENTRY (osx_select)
  TEST_ENTRY (osx_select_many_fds)
#endif

  TEST_ENTRY  (fs_file_noent)
  TEST_ENTRY  (fs_file_nametoolong)
  TEST_ENTRY  (fs_file_loop)
  TEST_ENTRY  (fs_file_async)
  TEST_ENTRY  (fs_file_sync)
  TEST_ENTRY  (fs_file_write_null_buffer)
  TEST_ENTRY  (fs_async_dir)
  TEST_ENTRY  (fs_async_sendfile)
  TEST_ENTRY  (fs_mkdtemp)
  TEST_ENTRY  (fs_fstat)
  TEST_ENTRY  (fs_access)
  TEST_ENTRY  (fs_chmod)
  TEST_ENTRY  (fs_chown)
  TEST_ENTRY  (fs_utime)
  TEST_ENTRY  (fs_futime)
  TEST_ENTRY  (fs_readlink)
  TEST_ENTRY  (fs_symlink)
  TEST_ENTRY  (fs_symlink_dir)
  TEST_ENTRY  (fs_stat_missing_path)
  TEST_ENTRY  (fs_read_file_eof)
  TEST_ENTRY  (fs_file_open_append)
  TEST_ENTRY  (fs_event_watch_dir)
  TEST_ENTRY  (fs_event_watch_file)
  TEST_ENTRY  (fs_event_watch_file_twice)
  TEST_ENTRY  (fs_event_watch_file_current_dir)
  TEST_ENTRY  (fs_event_no_callback_after_close)
  TEST_ENTRY  (fs_event_no_callback_on_close)
  TEST_ENTRY  (fs_event_immediate_close)
  TEST_ENTRY  (fs_event_close_with_pending_event)
  TEST_ENTRY  (fs_event_close_in_callback)
  TEST_ENTRY  (fs_event_start_and_close)
  TEST_ENTRY  (fs_event_error_reporting)
  TEST_ENTRY  (fs_event_getpath)
  TEST_ENTRY  (fs_scandir_empty_dir)
  TEST_ENTRY  (fs_scandir_file)
  TEST_ENTRY  (fs_open_dir)
  TEST_ENTRY  (fs_rename_to_existing_file)
  TEST_ENTRY  (fs_write_multiple_bufs)
  TEST_ENTRY  (threadpool_queue_work_simple)
  TEST_ENTRY  (threadpool_queue_work_einval)
  TEST_ENTRY  (threadpool_multiple_event_loops)
  TEST_ENTRY  (threadpool_cancel_getaddrinfo)
  TEST_ENTRY  (threadpool_cancel_getnameinfo)
  TEST_ENTRY  (threadpool_cancel_work)
  TEST_ENTRY  (threadpool_cancel_fs)
  TEST_ENTRY  (threadpool_cancel_single)
  TEST_ENTRY  (thread_local_storage)
  TEST_ENTRY  (thread_mutex)
  TEST_ENTRY  (thread_rwlock)
  TEST_ENTRY  (thread_create)
  TEST_ENTRY  (thread_equal)
  TEST_ENTRY  (dlerror)
  TEST_ENTRY  (ip4_addr)
  TEST_ENTRY  (ip6_addr_link_local)
#if 0
  /* These are for testing the test runner. */
  TEST_ENTRY  (fail_always)
  TEST_ENTRY  (pass_always)
#endif
TASK_LIST_END

{'repo_name': 'NetEase/libpomelo2', 'stars': '129', 'repo_language': 'C', 'file_name': 'TestPoll.java', 'mime_type': 'text/x-c', 'hash': 1172336635850418652, 'source_dataset': 'data'}


import random

from canari.maltego.transform import Transform
from canari.maltego.entities import URL
from canari.framework import EnableDebugWindow
from common.entities import NettackerScan

from lib.vuln.heartbleed.engine import start

from database.db import __logs_by_scan_id as find_log

__author__ = 'Shaddy Garg'
__copyright__ = 'Copyright 2018, nettacker_transforms Project'
__credits__ = []

__license__ = 'GPLv3'
__version__ = '0.1'
__maintainer__ = 'Shaddy Garg'
__email__ = 'shaddygarg1@gmail.com'
__status__ = 'Development'

@EnableDebugWindow
class HeartbleedVulnScan(Transform):
    """TODO: Your transform description."""

    # The transform input entity type.
    input_type = NettackerScan

    def do_transform(self, request, response, config):
        # TODO: write your code here.
        scan_request = request.entity
        scan_id = "".join(random.choice("0123456789abcdef") for x in range(32))
        scan_request.ports = scan_request.ports.split(', ') if scan_request.ports is not None else None
        start(scan_request.host, [], [], scan_request.ports, scan_request.timeout_sec, scan_request.thread_no,
              1, 1, 'abcd', 0, "en", scan_request.verbose, scan_request.socks_proxy, scan_request.retries, [], scan_id,
              "Through Maltego")
        results = find_log(scan_id, "en")
        for result in results:
            url = result["HOST"] + ":" + result["PORT"]
            response += URL(url=url, title=result["DESCRIPTION"],
                            short_title="Heartbleed Vulnerability Found!",
                            link_label='heartbleed_vuln')
        return response

    def on_terminate(self):
        """This method gets called when transform execution is prematurely terminated. It is only applicable for local
        transforms. It can be excluded if you don't need it."""
        pass

{'repo_name': 'zdresearch/OWASP-Nettacker', 'stars': '751', 'repo_language': 'Python', 'file_name': 'engine.py', 'mime_type': 'text/x-python', 'hash': 8219381754708421074, 'source_dataset': 'data'}


'use strict';

angular.
  module('core').
  filter('checkmark', function() {
    return function(input) {
      return input ? '\u2713' : '\u2718';
    };
  });

{'repo_name': 'angular/angular-phonecat', 'stars': '3107', 'repo_language': 'JavaScript', 'file_name': 'scenarios.js', 'mime_type': 'text/plain', 'hash': -4646786699674636285, 'source_dataset': 'data'}


Afiŝi

Komento

{'repo_name': 'owncloud/core', 'stars': '7121', 'repo_language': 'PHP', 'file_name': 'index.php', 'mime_type': 'text/x-php', 'hash': -6273891498923224488, 'source_dataset': 'data'}


#!/usr/bin/python3 -i
#
# Copyright (c) 2017-2020 The Khronos Group Inc.
# Copyright (c) 2017-2019 Valve Corporation
# Copyright (c) 2017-2019 LunarG, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author(s):    Mark Young <marky@lunarg.com>
#
# Purpose:      This file utilizes the content formatted in the
#               automatic_source_generator.py class to produce the
#               generated source code for the loader.

from automatic_source_generator import (AutomaticSourceOutputGenerator,
                                        undecorate)
from generator import write

# The following commands are manually implemented in the loader.
MANUAL_LOADER_FUNCS = set((
    'xrGetInstanceProcAddr',
    'xrEnumerateApiLayerProperties',
    'xrEnumerateInstanceExtensionProperties',
    'xrCreateInstance',
    'xrDestroyInstance',

    # For XR_EXT_debug_utils:
    'xrCreateDebugUtilsMessengerEXT',
    'xrDestroyDebugUtilsMessengerEXT',
    'xrSessionBeginDebugUtilsLabelRegionEXT',
    'xrSessionEndDebugUtilsLabelRegionEXT',
    'xrSessionInsertDebugUtilsLabelEXT',

    # For XR_KHR_loader_init:
    'xrInitializeLoaderKHR',
))

# This is a list of extensions that the loader implements.  This means that
# the runtime underneath may not support these extensions and the terminators
# need to check before they call
EXTENSIONS_LOADER_IMPLEMENTS = [
    'XR_EXT_debug_utils'
]

def generateErrorMessage(indent_level, vuid, cur_cmd, message, object_info):
    lines = []
    lines.append('LoaderLogger::LogValidationErrorMessage(')
    lines.append('    "VUID-{}",'.format('-'.join(vuid)))
    lines.append('    "{}",'.format(cur_cmd.name))
    lines.append('    {},'.format(message))

    object_info_constructors = ['XrSdkLogObjectInfo{%s, %s}' % p for p in object_info]
    if len(object_info_constructors) <= 1:
        lines.append('    {%s});' % (', '.join(object_info_constructors)))
    else:
        lines.append('    {')
        lines.append(',\n'.join('    %s' % x for x in object_info_constructors))
        lines.append('    });')
    if isinstance(indent_level, str):
        base_indent = indent_level
    else:
        base_indent = (4 * indent_level) * ' '
    indented_lines_with_lf = (''.join((base_indent, line, '\n')) for line in lines)
    return ''.join(indented_lines_with_lf)

# LoaderSourceOutputGenerator - subclass of AutomaticSourceOutputGenerator.
class LoaderSourceOutputGenerator(AutomaticSourceOutputGenerator):
    """Generate loader source using XML element attributes from registry"""

    def getProto(self, cur_cmd):
        # Make it a C calling convention and exported.
        return cur_cmd.cdecl.replace("XRAPI_ATTR", 'extern "C" LOADER_EXPORT XRAPI_ATTR')

    # Override the base class header warning so the comment indicates this file.
    #   self            the LoaderSourceOutputGenerator object

    def outputGeneratedHeaderWarning(self):
        generated_warning = '// *********** THIS FILE IS GENERATED - DO NOT EDIT ***********\n'
        generated_warning += '//     See loader_source_generator.py for modifications\n'
        generated_warning += '// ************************************************************\n'
        write(generated_warning, file=self.outFile)

    # Call the base class to properly begin the file, and then add
    # the file-specific header information.
    #   self            the LoaderSourceOutputGenerator object
    #   gen_opts        the LoaderSourceGeneratorOptions object
    def beginFile(self, genOpts):
        AutomaticSourceOutputGenerator.beginFile(self, genOpts)
        preamble = ''

        if self.genOpts.filename == 'xr_generated_loader.hpp':
            preamble += '#pragma once\n'
            preamble += '#include <unordered_map>\n'
            preamble += '#include <thread>\n'
            preamble += '#include <mutex>\n\n'
            preamble += '#include "xr_dependencies.h"\n'
            preamble += '#include "openxr/openxr.h"\n'
            preamble += '#include "openxr/openxr_platform.h"\n\n'
            preamble += '#include "loader_interfaces.h"\n\n'
            preamble += '#include "loader_instance.hpp"\n\n'
            preamble += '#include "loader_platform.hpp"\n\n'

        elif self.genOpts.filename == 'xr_generated_loader.cpp':
            preamble += '#include "xr_generated_loader.hpp"\n\n'
            preamble += '#include "api_layer_interface.hpp"\n'
            preamble += '#include "exception_handling.hpp"\n'
            preamble += '#include "hex_and_handles.h"\n'
            preamble += '#include "loader_instance.hpp"\n'
            preamble += '#include "loader_logger.hpp"\n'
            preamble += '#include "loader_platform.hpp"\n'
            preamble += '#include "runtime_interface.hpp"\n'
            preamble += '#include "xr_generated_dispatch_table.h"\n\n'

            preamble += '#include "xr_dependencies.h"\n'
            preamble += '#include <openxr/openxr.h>\n'
            preamble += '#include <openxr/openxr_platform.h>\n\n'

            preamble += '#include <cstring>\n'
            preamble += '#include <memory>\n'
            preamble += '#include <new>\n'
            preamble += '#include <string>\n'
            preamble += '#include <unordered_map>\n'

        write(preamble, file=self.outFile)

    # Write out all the information for the appropriate file,
    # and then call down to the base class to wrap everything up.
    #   self            the LoaderSourceOutputGenerator object
    def endFile(self):
        file_data = ''

        if self.genOpts.filename == 'xr_generated_loader.hpp':
            file_data += '#ifdef __cplusplus\n'
            file_data += 'extern "C" { \n'
            file_data += '#endif\n'
            file_data += self.outputLoaderManualFuncs()
            file_data += '#ifdef __cplusplus\n'
            file_data += '} // extern "C"\n'
            file_data += '#endif\n'

        elif self.genOpts.filename == 'xr_generated_loader.cpp':
            file_data += self.outputLoaderGeneratedFuncs()

        write(file_data, file=self.outFile)

        # Finish processing in superclass
        AutomaticSourceOutputGenerator.endFile(self)

    # Create prototypes for the loader's manually generated functions
    # so the generated code can call them.
    #   self            the LoaderSourceOutputGenerator object
    def outputLoaderManualFuncs(self):
        manual_funcs = '\n// Loader manually generated function prototypes\n\n'

        for cur_cmd in self.core_commands:
            if not cur_cmd.name in MANUAL_LOADER_FUNCS:
                if cur_cmd.protect_value:
                    manual_funcs += '#if %s\n' % cur_cmd.protect_string

                func_proto = self.getProto(cur_cmd)

                # Output the standard API form of the command
                manual_funcs += func_proto
                manual_funcs += '\n'

                if cur_cmd.protect_value:
                    manual_funcs += '#endif // %s\n' % cur_cmd.protect_string

        return manual_funcs

   # Output loader generated functions.  This has special cases for create and destroy commands
    # since we have to associate the created objects with the original instance during the create,
    # and then remove that association in the delete.
    #   self            the LoaderSourceOutputGenerator object
    def outputLoaderGeneratedFuncs(self):
        generated_funcs = '\n// Automatically generated instance trampolines and terminators\n'

        for cur_cmd in self.core_commands:

            if cur_cmd.name in MANUAL_LOADER_FUNCS:
                continue

            # Remove 'xr' from proto name
            base_name = cur_cmd.name[2:]

            has_return = False

            if cur_cmd.is_create_connect or cur_cmd.is_destroy_disconnect:
                has_return = True
            elif cur_cmd.return_type is not None:
                has_return = True

            tramp_variable_defines = ''
            tramp_param_replace = []
            base_handle_name = ''

            for count, param in enumerate(cur_cmd.params):
                param_cdecl = param.cdecl
                is_const = False
                const_check = param_cdecl.strip()
                if const_check[:5].lower() == "const":
                    is_const = True
                pointer_count = self.paramPointerCount(
                    param.cdecl, param.type, param.name)
                array_dimen = self.paramArrayDimension(
                    param.cdecl, param.type, param.name)

                static_array_sizes = []
                if param.is_static_array:
                    static_array_sizes = param.static_array_sizes

                cmd_tramp_param_name = param.name
                cmd_tramp_is_handle = param.is_handle
                if count == 0:
                    if param.is_handle:
                        base_handle_name = undecorate(param.type)
                        first_handle_name = self.getFirstHandleName(param)

                        tramp_variable_defines += '    LoaderInstance* loader_instance;\n'
                        tramp_variable_defines += '    XrResult result = ActiveLoaderInstance::Get(&loader_instance, "%s");\n' % (cur_cmd.name)
                        tramp_variable_defines += '    if (XR_SUCCEEDED(result)) {\n'

                        # These should be mutually exclusive - verify it.
                        assert((not cur_cmd.is_destroy_disconnect) or
                                (pointer_count == 0))
                    else:
                        tramp_variable_defines += self.printCodeGenErrorMessage(
                            'Command %s does not have an OpenXR Object handle as the first parameter.' % cur_cmd.name)

                tramp_param_replace.append(
                    self.MemberOrParam(type=param.type,
                                        name=cmd_tramp_param_name,
                                        is_const=is_const,
                                        is_handle=cmd_tramp_is_handle,
                                        is_bool=param.is_bool,
                                        is_optional=param.is_optional,
                                        no_auto_validity=param.no_auto_validity,
                                        is_array=param.is_array,
                                        is_static_array=param.is_static_array,
                                        static_array_sizes=static_array_sizes,
                                        array_dimen=array_dimen,
                                        array_count_var=param.array_count_var,
                                        array_length_for=param.array_length_for,
                                        pointer_count=pointer_count,
                                        pointer_count_var=param.pointer_count_var,
                                        is_null_terminated=param.is_null_terminated,
                                        valid_extension_structs=None,
                                        cdecl=param.cdecl,
                                        values=param.values))
                count = count + 1

            if cur_cmd.protect_value:
                generated_funcs += '#if %s\n' % cur_cmd.protect_string
            decl = self.getProto(cur_cmd).replace(";", " XRLOADER_ABI_TRY {\n")

            generated_funcs += decl
            generated_funcs += tramp_variable_defines

            if has_return:
                generated_funcs += '        result = '
            else:
                generated_funcs += '        '

            generated_funcs += 'loader_instance->DispatchTable()->'
            generated_funcs += base_name
            generated_funcs += '('
            count = 0
            for param in tramp_param_replace:
                if count > 0:
                    generated_funcs += ', '
                generated_funcs += param.name
                count = count + 1
            generated_funcs += ');\n'

            generated_funcs += '    }\n'

            if has_return:
                generated_funcs += '    return result;\n'

            generated_funcs += '}\nXRLOADER_ABI_CATCH_FALLBACK\n'

            if cur_cmd.protect_value:
                generated_funcs += '#endif // %s\n' % cur_cmd.protect_string
            generated_funcs += '\n'
        return generated_funcs

{'repo_name': 'KhronosGroup/OpenXR-SDK-Source', 'stars': '169', 'repo_language': 'Python', 'file_name': 'openxr_platform_defines.h', 'mime_type': 'text/x-c', 'hash': 2231740385144416807, 'source_dataset': 'data'}


ISRStack = 64 * 32;
MainStack = 128 * 32;
TaskStack = 0;
MaxTasks = 1;

INCLUDE stm32/f407xg
INCLUDE stm32/loadram
INCLUDE noos-cortexm

{'repo_name': 'ziutek/emgo', 'stars': '850', 'repo_language': 'C', 'file_name': 'stm32f0xx.h', 'mime_type': 'text/x-c', 'hash': -7069951747131804876, 'source_dataset': 'data'}


object ImageListEditorDlg: TImageListEditorDlg
  Left = 453
  Height = 484
  Top = 144
  Width = 617
  BorderIcons = [biSystemMenu, biHelp]
  Caption = 'ImagesList Editor'
  ClientHeight = 484
  ClientWidth = 617
  Constraints.MinHeight = 394
  Constraints.MinWidth = 560
  OnClose = FormClose
  OnCreate = FormCreate
  OnResize = FormResize
  OnShow = FormShow
  Position = poScreenCenter
  LCLVersion = '2.1.0.0'
  object GroupBoxR: TGroupBox
    AnchorSideLeft.Control = GroupBoxL
    AnchorSideLeft.Side = asrBottom
    AnchorSideTop.Control = Owner
    AnchorSideRight.Control = Owner
    AnchorSideRight.Side = asrBottom
    AnchorSideBottom.Control = BtnPanel
    Left = 372
    Height = 440
    Top = 6
    Width = 239
    Anchors = [akTop, akLeft, akRight, akBottom]
    BorderSpacing.Around = 6
    Caption = 'Selected Image'
    ClientHeight = 420
    ClientWidth = 235
    TabOrder = 1
    object LabelTransparent: TLabel
      AnchorSideLeft.Control = RadioGroup
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = RadioGroup
      Left = 93
      Height = 24
      Top = 304
      Width = 97
      Anchors = [akTop, akLeft, akBottom]
      BorderSpacing.Left = 6
      Caption = 'Transparent Color:'
      ParentColor = False
    end
    object Preview: TScrollBox
      AnchorSideLeft.Control = GroupBoxR
      AnchorSideTop.Control = GroupBoxR
      AnchorSideRight.Control = GroupBoxR
      AnchorSideRight.Side = asrBottom
      AnchorSideBottom.Control = RadioGroup
      Left = 6
      Height = 292
      Top = 6
      Width = 223
      HorzScrollBar.Increment = 1
      HorzScrollBar.Page = 1
      HorzScrollBar.Smooth = True
      HorzScrollBar.Tracking = True
      VertScrollBar.Increment = 1
      VertScrollBar.Page = 1
      VertScrollBar.Smooth = True
      VertScrollBar.Tracking = True
      Anchors = [akTop, akLeft, akRight, akBottom]
      BorderSpacing.Around = 6
      Color = clDefault
      ParentColor = False
      TabOrder = 0
    end
    object RadioGroup: TRadioGroup
      AnchorSideLeft.Control = GroupBoxR
      AnchorSideBottom.Control = GroupBoxR
      AnchorSideBottom.Side = asrBottom
      Left = 6
      Height = 110
      Top = 304
      Width = 81
      Anchors = [akLeft, akBottom]
      AutoFill = True
      AutoSize = True
      BorderSpacing.Around = 6
      Caption = 'Adjustment'
      ChildSizing.LeftRightSpacing = 6
      ChildSizing.TopBottomSpacing = 4
      ChildSizing.VerticalSpacing = 2
      ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
      ChildSizing.EnlargeVertical = crsHomogenousSpaceResize
      ChildSizing.ShrinkHorizontal = crsScaleChilds
      ChildSizing.ShrinkVertical = crsScaleChilds
      ChildSizing.Layout = cclLeftToRightThenTopToBottom
      ChildSizing.ControlsPerLine = 1
      ClientHeight = 90
      ClientWidth = 77
      Enabled = False
      ItemIndex = 0
      Items.Strings = (
        'None'
        'Stretch'
        'Crop'
        'Center'
      )
      OnClick = ColorBoxTransparentClick
      TabOrder = 1
    end
    object ColorBoxTransparent: TColorBox
      AnchorSideLeft.Control = LabelTransparent
      AnchorSideTop.Control = LabelTransparent
      AnchorSideTop.Side = asrBottom
      Left = 93
      Height = 22
      Top = 332
      Width = 96
      Selected = clFuchsia
      Style = [cbStandardColors, cbExtendedColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
      BorderSpacing.Top = 4
      Enabled = False
      ItemHeight = 16
      OnChange = ColorBoxTransparentClick
      TabOrder = 2
    end
  end
  object GroupBoxL: TGroupBox
    AnchorSideLeft.Control = Owner
    AnchorSideTop.Control = Owner
    AnchorSideBottom.Control = BtnPanel
    Left = 6
    Height = 440
    Top = 6
    Width = 360
    Anchors = [akTop, akLeft, akBottom]
    AutoSize = True
    BorderSpacing.Around = 6
    Caption = 'Images'
    ClientHeight = 420
    ClientWidth = 356
    TabOrder = 0
    object BtnAdd: TButton
      Tag = 1
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = ImageListBox
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 6
      Width = 57
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Right = 6
      Caption = 'Add...'
      OnClick = BtnAddClick
      TabOrder = 0
    end
    object BtnClear: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnDelete
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 180
      Width = 53
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Clear'
      OnClick = BtnClearClick
      TabOrder = 6
    end
    object BtnDelete: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnReplaceAll
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 151
      Width = 59
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = '&Delete'
      OnClick = BtnDeleteClick
      TabOrder = 5
    end
    object BtnMoveUp: TButton
      Tag = -1
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnClear
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 209
      Width = 74
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Move Up'
      OnClick = BtnMoveUpDownClick
      TabOrder = 7
    end
    object BtnMoveDown: TButton
      Tag = 1
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnMoveUp
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 238
      Width = 90
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Move Down'
      OnClick = BtnMoveUpDownClick
      TabOrder = 8
    end
    object BtnSave: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnMoveDown
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 267
      Width = 59
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Save...'
      OnClick = BtnSaveClick
      TabOrder = 9
    end
    object btnSaveAll: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnSave
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 296
      Width = 76
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Save All...'
      OnClick = btnSaveAllClick
      TabOrder = 10
    end
    object BtnReplace: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnAddSliced
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 93
      Width = 76
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = '&Replace...'
      OnClick = BtnReplaceClick
      TabOrder = 3
    end
    object ImageListBox: TListBox
      AnchorSideLeft.Control = GroupBoxL
      AnchorSideTop.Control = GroupBoxL
      AnchorSideBottom.Control = GroupBoxL
      AnchorSideBottom.Side = asrBottom
      Left = 6
      Height = 408
      Top = 6
      Width = 186
      Anchors = [akTop, akLeft, akBottom]
      BorderSpacing.Around = 6
      ItemHeight = 0
      OnDrawItem = ImageListBoxDrawItem
      OnSelectionChange = ImageListBoxSelectionChange
      Options = []
      Style = lbOwnerDrawFixed
      TabOrder = 11
    end
    object btnAddNewResolution: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = btnSaveAll
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 325
      Width = 138
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Add new resolution...'
      OnClick = btnAddNewResolutionClick
      TabOrder = 12
    end
    object BtnReplaceAll: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnReplace
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 122
      Width = 152
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = '&Replace all resolutions...'
      OnClick = BtnReplaceClick
      TabOrder = 4
    end
    object BtnAddMoreResolutions: TButton
      Tag = 1
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnAdd
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 35
      Width = 149
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Add more resolutions...'
      OnClick = BtnAddClick
      TabOrder = 1
    end
    object btnDeleteResolution: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = btnAddNewResolution
      AnchorSideTop.Side = asrBottom
      AnchorSideRight.Side = asrBottom
      Left = 198
      Height = 25
      Top = 354
      Width = 127
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Delete resolution ...'
      OnClick = btnDeleteResolutionClick
      TabOrder = 13
    end
    object BtnAddSliced: TButton
      AnchorSideLeft.Control = ImageListBox
      AnchorSideLeft.Side = asrBottom
      AnchorSideTop.Control = BtnAddMoreResolutions
      AnchorSideTop.Side = asrBottom
      Left = 198
      Height = 25
      Top = 64
      Width = 90
      AutoSize = True
      BorderSpacing.Left = 6
      BorderSpacing.Top = 4
      BorderSpacing.Right = 6
      Caption = 'Add sliced...'
      OnClick = BtnAddSlicedClick
      TabOrder = 2
    end
  end
  object BtnPanel: TButtonPanel
    Left = 6
    Height = 26
    Top = 452
    Width = 605
    OKButton.Name = 'OKButton'
    OKButton.DefaultCaption = True
    HelpButton.Name = 'HelpButton'
    HelpButton.DefaultCaption = True
    CloseButton.Name = 'CloseButton'
    CloseButton.DefaultCaption = True
    CancelButton.Name = 'CancelButton'
    CancelButton.DefaultCaption = True
    TabOrder = 2
    ShowBevel = False
  end
  object ImageList: TImageList
    left = 84
    top = 211
  end
  object OpenDialog: TOpenPictureDialog
    FilterIndex = 0
    Options = [ofAllowMultiSelect, ofFileMustExist, ofEnableSizing, ofViewDetail, ofAutoPreview]
    left = 84
    top = 103
  end
  object SaveDialog: TSavePictureDialog
    FilterIndex = 0
    Options = [ofEnableSizing, ofViewDetail, ofAutoPreview]
    left = 84
    top = 159
  end
end

{'repo_name': 'graemeg/lazarus', 'stars': '288', 'repo_language': 'Pascal', 'file_name': 'lazbuild.1', 'mime_type': 'text/troff', 'hash': 8694271720039135867, 'source_dataset': 'data'}


pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == bg-fixed-1.html bg-fixed-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == bg-fixed-cover-1.html bg-fixed-cover-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == bg-fixed-cover-2.html bg-fixed-cover-2-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == bg-fixed-cover-3.html bg-fixed-cover-3-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == element-1.html element-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == nested-1.html nested-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == position-fixed-1.html position-fixed-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == position-fixed-2.html position-fixed-2-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == position-fixed-cover-1.html position-fixed-cover-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == position-fixed-cover-2.html position-fixed-cover-2-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == position-fixed-cover-3.html position-fixed-cover-3-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == split-layers-1.html split-layers-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == split-layers-multi-scrolling-1.html split-layers-multi-scrolling-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == split-opacity-layers-1.html split-opacity-layers-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == sticky-pos-scrollable-1.html sticky-pos-scrollable-1-ref.html
pref(layout.async-containerless-scrolling.enabled,true) pref(apz.subframe.enabled,true) skip-if(!asyncPanZoom) == fixed-pos-scrollable-1.html fixed-pos-scrollable-1-ref.html

pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == bg-fixed-1.html bg-fixed-1-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == bg-fixed-cover-1.html bg-fixed-cover-1-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == bg-fixed-cover-2.html bg-fixed-cover-2-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == bg-fixed-cover-3.html bg-fixed-cover-3-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == element-1.html element-1-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == position-fixed-1.html position-fixed-1-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == position-fixed-2.html position-fixed-2-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == position-fixed-cover-1.html position-fixed-cover-1-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == position-fixed-cover-2.html position-fixed-cover-2-ref.html
pref(layout.async-containerless-scrolling.enabled,false) skip-if(!asyncPanZoom) == position-fixed-cover-3.html position-fixed-cover-3-ref.html

# for the following tests, we want to disable the low-precision buffer
# as it will expand the displayport beyond what the test specifies in
# its reftest-displayport attributes, and interfere with where we expect
# checkerboarding to occur
default-preferences pref(layers.low-precision-buffer,false)
skip-if(!asyncPanZoom) == checkerboard-1.html checkerboard-1-ref.html
skip-if(!asyncPanZoom) == checkerboard-2.html checkerboard-2-ref.html
skip-if(!asyncPanZoom) == checkerboard-3.html checkerboard-3-ref.html
default-preferences

{'repo_name': 'ricardoquesada/Spidermonkey', 'stars': '201', 'repo_language': 'C++', 'file_name': 'panelUI.css', 'mime_type': 'text/plain', 'hash': 3817851851129458117, 'source_dataset': 'data'}


/*
 * Copyright 2010-2011 Research In Motion Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package blackberry.bbm.platform.self.profilebox;

import blackberry.bbm.platform.util.Util;
import net.rim.blackberry.api.bbm.platform.profile.UserProfileBox;
import net.rim.blackberry.api.bbm.platform.profile.UserProfileBoxItem;
import net.rim.device.api.script.Scriptable;
import net.rim.device.api.system.EncodedImage;

public class ScriptableProfileBoxItem extends Scriptable {

    private static final String FIELD_ID =     "id";
    private static final String FIELD_TEXT =   "text";
    private static final String FIELD_ICON =   "icon";
    private static final String FIELD_COOKIE = "cookie";

    private final UserProfileBox _box;
    private final UserProfileBoxItem _item;

    public ScriptableProfileBoxItem(UserProfileBox box, UserProfileBoxItem item) {
        _box = box;
        _item = item;
    }

    public Object getField(String name) throws Exception {
        if(name.equals(FIELD_ID)) {
            return new Integer(_item.getItemId());
        } else if(name.equals(FIELD_TEXT)) {
            return _item.getText();
        } else if(name.equals(FIELD_ICON)) {
            return this.getIcon();
        } else if(name.equals(FIELD_COOKIE)) {
            final String cookie = _item.getCookie();
            if(cookie != null) {
                return cookie;
            } else {
                return UNDEFINED;
            }
        } else {
            return super.getField(name);
        }
    }

    public Object getIcon() {
        final int iconId = _item.getIconId();
        if(iconId == -1) {
            return UNDEFINED;
        } else {
            final EncodedImage icon = _box.getIcon(_item.getIconId());
            if(icon == null) {
                return UNDEFINED;
            } else {
                return Util.bitmapToBase64Str(icon.getBitmap());
            }
        }
    }

    public UserProfileBoxItem getItem() {
        return _item;
    }
}

{'repo_name': 'blackberry/WebWorks', 'stars': '263', 'repo_language': 'Java', 'file_name': 'dist.xml', 'mime_type': 'text/plain', 'hash': -6815663078317844876, 'source_dataset': 'data'}


// Karma configuration for all the tests

sharedConfig = require("./karma-shared.conf.js");

module.exports = function (config) {
    var testFiles = [
        {
            pattern: 'test/**/*Spec.js',
            included: false
        }
    ];

    sharedConfig(config);

    config.files = config.files.concat(testFiles);
};

{'repo_name': 'llaske/sugarizer', 'stars': '122', 'repo_language': 'JavaScript', 'file_name': 'selectbox.js', 'mime_type': 'text/plain', 'hash': -1264222077532660582, 'source_dataset': 'data'}


/*
 * Copyright 2012 ZXing authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import "ZXOneDimensionalCodeWriter.h"

/**
 * This object renders a CODE39 code as a ZXBitMatrix.
 */
@interface ZXCode39Writer : ZXOneDimensionalCodeWriter

@end

{'repo_name': 'zxingify/zxingify-objc', 'stars': '2934', 'repo_language': 'Objective-C', 'file_name': 'ZXAI01_3202_3203_DecoderTest.m', 'mime_type': 'text/x-objective-c', 'hash': 665692734309916494, 'source_dataset': 'data'}


{'repo_name': 'ProjectNami/projectnami', 'stars': '224', 'repo_language': 'PHP', 'file_name': 'media-widgets.js', 'mime_type': 'text/plain', 'hash': 1449043651480506558, 'source_dataset': 'data'}


[NAME]
sha224sum \- compute and check SHA224 message digest
[DESCRIPTION]
.\" Add any additional description here

{'repo_name': 'coreutils/coreutils', 'stars': '1691', 'repo_language': 'C', 'file_name': 'sort-version.texi', 'mime_type': 'text/plain', 'hash': 8753972617600196771, 'source_dataset': 'data'}


<?php

namespace Drupal\comment\Tests;

use Drupal\user\RoleInterface;

/**
 * Tests anonymous commenting.
 *
 * @group comment
 */
class CommentAnonymousTest extends CommentTestBase {

  protected function setUp() {
    parent::setUp();

    // Enable anonymous and authenticated user comments.
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
      'access comments',
      'post comments',
      'skip comment approval',
    ]);
    user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, [
      'access comments',
      'post comments',
      'skip comment approval',
    ]);
  }

  /**
   * Tests anonymous comment functionality.
   */
  public function testAnonymous() {
    $this->drupalLogin($this->adminUser);
    $this->setCommentAnonymous(COMMENT_ANONYMOUS_MAYNOT_CONTACT);
    $this->drupalLogout();

    // Preview comments (with `skip comment approval` permission).
    $edit = [];
    $title = 'comment title with skip comment approval';
    $body = 'comment body with skip comment approval';
    $edit['subject[0][value]'] = $title;
    $edit['comment_body[0][value]'] = $body;
    $this->drupalPostForm($this->node->urlInfo(), $edit, t('Preview'));
    // Cannot use assertRaw here since both title and body are in the form.
    $preview = (string) $this->cssSelect('.preview')[0]->asXML();
    $this->assertTrue(strpos($preview, $title) !== FALSE, 'Anonymous user can preview comment title.');
    $this->assertTrue(strpos($preview, $body) !== FALSE, 'Anonymous user can preview comment body.');

    // Preview comments (without `skip comment approval` permission).
    user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['skip comment approval']);
    $edit = [];
    $title = 'comment title without skip comment approval';
    $body = 'comment body without skip comment approval';
    $edit['subject[0][value]'] = $title;
    $edit['comment_body[0][value]'] = $body;
    $this->drupalPostForm($this->node->urlInfo(), $edit, t('Preview'));
    // Cannot use assertRaw here since both title and body are in the form.
    $preview = (string) $this->cssSelect('.preview')[0]->asXML();
    $this->assertTrue(strpos($preview, $title) !== FALSE, 'Anonymous user can preview comment title.');
    $this->assertTrue(strpos($preview, $body) !== FALSE, 'Anonymous user can preview comment body.');
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['skip comment approval']);

    // Post anonymous comment without contact info.
    $anonymous_comment1 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
    $this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');

    // Ensure anonymous users cannot post in the name of registered users.
    $edit = [
      'name' => $this->adminUser->getUsername(),
      'comment_body[0][value]' => $this->randomMachineName(),
    ];
    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save'));
    $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
      '%name' => $this->adminUser->getUsername(),
    ]));

    // Allow contact info.
    $this->drupalLogin($this->adminUser);
    $this->setCommentAnonymous(COMMENT_ANONYMOUS_MAY_CONTACT);

    // Attempt to edit anonymous comment.
    $this->drupalGet('comment/' . $anonymous_comment1->id() . '/edit');
    $edited_comment = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName());
    $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
    $this->drupalLogout();

    // Post anonymous comment with contact info (optional).
    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
    $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');

    // Check the presence of expected cache tags.
    $this->assertCacheTag('config:field.field.node.article.comment');
    $this->assertCacheTag('config:user.settings');

    $anonymous_comment2 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
    $this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');

    // Ensure anonymous users cannot post in the name of registered users.
    $edit = [
      'name' => $this->adminUser->getUsername(),
      'mail' => $this->randomMachineName() . '@example.com',
      'subject[0][value]' => $this->randomMachineName(),
      'comment_body[0][value]' => $this->randomMachineName(),
    ];
    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save'));
    $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
      '%name' => $this->adminUser->getUsername(),
    ]));

    // Require contact info.
    $this->drupalLogin($this->adminUser);
    $this->setCommentAnonymous(COMMENT_ANONYMOUS_MUST_CONTACT);
    $this->drupalLogout();

    // Try to post comment with contact info (required).
    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
    $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');

    $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
    // Name should have 'Anonymous' for value by default.
    $this->assertText(t('Email field is required.'), 'Email required.');
    $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');

    // Post comment with contact info (required).
    $author_name = $this->randomMachineName();
    $author_mail = $this->randomMachineName() . '@example.com';
    $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), ['name' => $author_name, 'mail' => $author_mail]);
    $this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');

    // Make sure the user data appears correctly when editing the comment.
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit');
    $this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
    $this->assertFieldByName('uid', '', 'The author field is empty (i.e. anonymous) when editing the comment.');
    $this->assertRaw($author_mail, "The anonymous user's email address is correct when editing the comment.");

    // Unpublish comment.
    $this->performCommentOperation($anonymous_comment3, 'unpublish');

    $this->drupalGet('admin/content/comment/approval');
    $this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was unpublished.');

    // Publish comment.
    $this->performCommentOperation($anonymous_comment3, 'publish', TRUE);

    $this->drupalGet('admin/content/comment');
    $this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was published.');

    // Delete comment.
    $this->performCommentOperation($anonymous_comment3, 'delete');

    $this->drupalGet('admin/content/comment');
    $this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was deleted.');
    $this->drupalLogout();

    // Comment 3 was deleted.
    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $anonymous_comment3->id());
    $this->assertResponse(403);

    // Reset.
    user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
      'access comments' => FALSE,
      'post comments' => FALSE,
      'skip comment approval' => FALSE,
    ]);

    // Attempt to view comments while disallowed.
    // NOTE: if authenticated user has permission to post comments, then a
    // "Login or register to post comments" type link may be shown.
    $this->drupalGet('node/' . $this->node->id());
    $this->assertNoPattern('@
]*>Comments
@', 'Comments were not displayed.');
    $this->assertNoLink('Add new comment', 'Link to add comment was found.');

    // Attempt to view node-comment form while disallowed.
    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
    $this->assertResponse(403);

    user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
      'access comments' => TRUE,
      'post comments' => FALSE,
      'skip comment approval' => FALSE,
    ]);
    $this->drupalGet('node/' . $this->node->id());
    $this->assertPattern('@
]*>Comments
@', 'Comments were displayed.');
    $this->assertLink('Log in', 1, 'Link to login was found.');
    $this->assertLink('register', 1, 'Link to register was found.');

    user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
      'access comments' => FALSE,
      'post comments' => TRUE,
      'skip comment approval' => TRUE,
    ]);
    $this->drupalGet('node/' . $this->node->id());
    $this->assertNoPattern('@
]*>Comments
@', 'Comments were not displayed.');
    $this->assertFieldByName('subject[0][value]', '', 'Subject field found.');
    $this->assertFieldByName('comment_body[0][value]', '', 'Comment field found.');

    $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $anonymous_comment2->id());
    $this->assertResponse(403);
  }

}

{'repo_name': 'fossasia/phimpme-drupal', 'stars': '1111', 'repo_language': 'PHP', 'file_name': 'jquery.ui.datepicker.css', 'mime_type': 'text/plain', 'hash': 8099315630668862199, 'source_dataset': 'data'}


[pytest]
#  monitor.py requires optional linotify, but would blow tests discovery, does not contain tests within
addopts = --doctest-modules --tb=short --ignore heudiconv/cli/monitor.py

{'repo_name': 'nipy/heudiconv', 'stars': '121', 'repo_language': 'Python', 'file_name': 'singularity-env.def', 'mime_type': 'text/plain', 'hash': 5913160397345589509, 'source_dataset': 'data'}


/*
*  AngularJs Fullcalendar Wrapper for the JQuery FullCalendar
*  API @ http://arshaw.com/fullcalendar/
*
*  Angular Calendar Directive that takes in the [eventSources] nested array object as the ng-model and watches it deeply changes.
*       Can also take in multiple event urls as a source object(s) and feed the events per view.
*       The calendar will watch any eventSource array and update itself when a change is made.
*
*/

angular.module('ui.calendar', [])
  .constant('uiCalendarConfig', {calendars: {}})
  .controller('uiCalendarCtrl', ['$scope',
                                 '$timeout',
                                 '$locale', function(
                                  $scope,
                                  $timeout,
                                  $locale){

      var sourceSerialId = 1,
          eventSerialId = 1,
          sources = $scope.eventSources,
          extraEventSignature = $scope.calendarWatchEvent ? $scope.calendarWatchEvent : angular.noop,

          wrapFunctionWithScopeApply = function(functionToWrap){
              var wrapper;

              if (functionToWrap){
                  wrapper = function(){
                      // This happens outside of angular context so we need to wrap it in a timeout which has an implied apply.
                      // In this way the function will be safely executed on the next digest.

                      var args = arguments;
                      var _this = this;
                      $timeout(function(){
                        functionToWrap.apply(_this, args);
                      });
                  };
              }

              return wrapper;
          };

      this.eventsFingerprint = function(e) {
        if (!e._id) {
          e._id = eventSerialId++;
        }
        // This extracts all the information we need from the event. http://jsperf.com/angular-calendar-events-fingerprint/3
        return "" + e._id + (e.id || '') + (e.title || '') + (e.url || '') + (+e.start || '') + (+e.end || '') +
          (e.allDay || '') + (e.className || '') + extraEventSignature(e) || '';
      };

      this.sourcesFingerprint = function(source) {
          return source.__id || (source.__id = sourceSerialId++);
      };

      this.allEvents = function() {
        // return sources.flatten(); but we don't have flatten
        var arraySources = [];
        for (var i = 0, srcLen = sources.length; i < srcLen; i++) {
          var source = sources[i];
          if (angular.isArray(source)) {
            // event source as array
            arraySources.push(source);
          } else if(angular.isObject(source) && angular.isArray(source.events)){
            // event source as object, ie extended form
            var extEvent = {};
            for(var key in source){
              if(key !== '_uiCalId' && key !== 'events'){
                 extEvent[key] = source[key];
              }
            }
            for(var eI = 0;eI < source.events.length;eI++){
              angular.extend(source.events[eI],extEvent);
            }
            arraySources.push(source.events);
          }
        }

        return Array.prototype.concat.apply([], arraySources);
      };

      // Track changes in array by assigning id tokens to each element and watching the scope for changes in those tokens
      // arguments:
      //  arraySource array of function that returns array of objects to watch
      //  tokenFn function(object) that returns the token for a given object
      this.changeWatcher = function(arraySource, tokenFn) {
        var self;
        var getTokens = function() {
          var array = angular.isFunction(arraySource) ? arraySource() : arraySource;
          var result = [], token, el;
          for (var i = 0, n = array.length; i < n; i++) {
            el = array[i];
            token = tokenFn(el);
            map[token] = el;
            result.push(token);
          }
          return result;
        };
        // returns elements in that are in a but not in b
        // subtractAsSets([4, 5, 6], [4, 5, 7]) => [6]
        var subtractAsSets = function(a, b) {
          var result = [], inB = {}, i, n;
          for (i = 0, n = b.length; i < n; i++) {
            inB[b[i]] = true;
          }
          for (i = 0, n = a.length; i < n; i++) {
            if (!inB[a[i]]) {
              result.push(a[i]);
            }
          }
          return result;
        };

        // Map objects to tokens and vice-versa
        var map = {};

        var applyChanges = function(newTokens, oldTokens) {
          var i, n, el, token;
          var replacedTokens = {};
          var removedTokens = subtractAsSets(oldTokens, newTokens);
          for (i = 0, n = removedTokens.length; i < n; i++) {
            var removedToken = removedTokens[i];
            el = map[removedToken];
            delete map[removedToken];
            var newToken = tokenFn(el);
            // if the element wasn't removed but simply got a new token, its old token will be different from the current one
            if (newToken === removedToken) {
              self.onRemoved(el);
            } else {
              replacedTokens[newToken] = removedToken;
              self.onChanged(el);
            }
          }

          var addedTokens = subtractAsSets(newTokens, oldTokens);
          for (i = 0, n = addedTokens.length; i < n; i++) {
            token = addedTokens[i];
            el = map[token];
            if (!replacedTokens[token]) {
              self.onAdded(el);
            }
          }
        };
        return self = {
          subscribe: function(scope, onChanged) {
            scope.$watch(getTokens, function(newTokens, oldTokens) {
              if (!onChanged || onChanged(newTokens, oldTokens) !== false) {
                applyChanges(newTokens, oldTokens);
              }
            }, true);
          },
          onAdded: angular.noop,
          onChanged: angular.noop,
          onRemoved: angular.noop
        };
      };

      this.getFullCalendarConfig = function(calendarSettings, uiCalendarConfig){
          var config = {};

          angular.extend(config, uiCalendarConfig);
          angular.extend(config, calendarSettings);

          angular.forEach(config, function(value,key){
            if (typeof value === 'function'){
              config[key] = wrapFunctionWithScopeApply(config[key]);
            }
          });

          return config;
      };

    this.getLocaleConfig = function(fullCalendarConfig) {
      if (!fullCalendarConfig.lang || fullCalendarConfig.useNgLocale) {
        // Configure to use locale names by default
        var tValues = function(data) {
          // convert {0: "Jan", 1: "Feb", ...} to ["Jan", "Feb", ...]
          var r, k;
          r = [];
          for (k in data) {
            r[k] = data[k];
          }
          return r;
        };
        var dtf = $locale.DATETIME_FORMATS;
        return {
          monthNames: tValues(dtf.MONTH),
          monthNamesShort: tValues(dtf.SHORTMONTH),
          dayNames: tValues(dtf.DAY),
          dayNamesShort: tValues(dtf.SHORTDAY)
        };
      }
      return {};
    };
  }])
  .directive('uiCalendar', ['uiCalendarConfig', function(uiCalendarConfig) {
    return {
      restrict: 'A',
      scope: {eventSources:'=ngModel',calendarWatchEvent: '&'},
      controller: 'uiCalendarCtrl',
      link: function(scope, elm, attrs, controller) {

        var sources = scope.eventSources,
            sourcesChanged = false,
            calendar,
            eventSourcesWatcher = controller.changeWatcher(sources, controller.sourcesFingerprint),
            eventsWatcher = controller.changeWatcher(controller.allEvents, controller.eventsFingerprint),
            options = null;

        function getOptions(){
          var calendarSettings = attrs.uiCalendar ? scope.$parent.$eval(attrs.uiCalendar) : {},
              fullCalendarConfig;

          fullCalendarConfig = controller.getFullCalendarConfig(calendarSettings, uiCalendarConfig);

          var localeFullCalendarConfig = controller.getLocaleConfig(fullCalendarConfig);
          angular.extend(localeFullCalendarConfig, fullCalendarConfig);
          options = { eventSources: sources };
          angular.extend(options, localeFullCalendarConfig);
          //remove calendars from options
          options.calendars = null;

          var options2 = {};
          for(var o in options){
            if(o !== 'eventSources'){
              options2[o] = options[o];
            }
          }
          return JSON.stringify(options2);
        }

        scope.destroy = function(){
          if(calendar && calendar.fullCalendar){
            calendar.fullCalendar('destroy');
          }
          if(attrs.calendar) {
            calendar = uiCalendarConfig.calendars[attrs.calendar] = $(elm).html('');
          } else {
            calendar = $(elm).html('');
          }
        };

        scope.init = function(){
          calendar.fullCalendar(options);
        };

        eventSourcesWatcher.onAdded = function(source) {
            calendar.fullCalendar('addEventSource', source);
            sourcesChanged = true;
        };

        eventSourcesWatcher.onRemoved = function(source) {
          calendar.fullCalendar('removeEventSource', source);
          sourcesChanged = true;
        };

        eventsWatcher.onAdded = function(event) {
          calendar.fullCalendar('renderEvent', event);
        };

        eventsWatcher.onRemoved = function(event) {
          calendar.fullCalendar('removeEvents', function(e) {
            return e._id === event._id;
          });
        };

        eventsWatcher.onChanged = function(event) {
          event._start = $.fullCalendar.moment(event.start);
          event._end = $.fullCalendar.moment(event.end);
          calendar.fullCalendar('updateEvent', event);
        };

        eventSourcesWatcher.subscribe(scope);
        eventsWatcher.subscribe(scope, function(newTokens, oldTokens) {
          if (sourcesChanged === true) {
            sourcesChanged = false;
            // prevent incremental updates in this case
            return false;
          }
        });

        scope.$watch(getOptions, function(newO,oldO){
            scope.destroy();
            scope.init();
        });
      }
    };
}]);

{'repo_name': 'salboaie/SwarmESB', 'stars': '142', 'repo_language': 'JavaScript', 'file_name': 'usage.js', 'mime_type': 'text/plain', 'hash': -3930903729037115604, 'source_dataset': 'data'}


function imgTMO_c = ColorCorrectionPouli(imgHDR, imgTMO)
%
%       imgTMO_c = ColorCorrection(imgHDR, imgTMO)
%
%       This function saturates/desaturates colors in an imgTMO
%
%       input:
%         - imgHDR: an HDR image in RGB color space.
%         - imgTMO: a tone mapped version of imgHDR in a linear RGB color space.
%
%       output:
%         - imgTMO_c: imgTMO with color correction in a linear RGB color
%         space.
%
%     Copyright (C) 2013-2017  Francesco Banterle
%
%     This program is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     (at your option) any later version.
%
%     This program is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%     GNU General Public License for more details.
%
%     You should have received a copy of the GNU General Public License
%     along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
%     The paper describing this technique is:
%     "Color Correction for Tone Reproduction"
% 	  by Tania Pouli1, Alessandro Artusi, Francesco Banterle,
%     Ahmet Oguz Akyuz, Hans-Peter Seidel and Erik Reinhard
%     in the Twenty-first Color and Imaging Conference (CIC21), Albuquerque, Nov. 2013
%

if(~isSameImage(imgHDR, imgTMO))
    error('ERROR: imgHDR and imgTMO have different spatial resolutions.');
end

check3Color(imgHDR);

%normalization step
max_TMO = max(imgTMO(:));
max_HDR = max(imgHDR(:));
imgHDR = imgHDR / max_HDR;
imgTMO = imgTMO / max_TMO;

%conversion from RGB to XYZ
imgTMO_XYZ = ConvertRGBtoXYZ(imgTMO, 0);
imgHDR_XYZ = ConvertRGBtoXYZ(imgHDR, 0);
%conversion from XYZ to IPT
imgTMO_IPT = ConvertXYZtoIPT(imgTMO_XYZ, 0);
imgHDR_IPT = ConvertXYZtoIPT(imgHDR_XYZ, 0);
%conversion from IPT to ICh
imgTMO_ICh = ConvertIPTtoICh(imgTMO_IPT, 0);
imgHDR_ICh = ConvertIPTtoICh(imgHDR_IPT, 0);

%the main algorithm
C_TMO_prime = imgTMO_IPT(:,:,2) .* imgHDR_ICh(:,:,1) ./ imgTMO_ICh(:,:,1);
r1 = SaturationPouli(imgHDR_ICh(:,:,2), imgHDR_ICh(:,:,1));
r2 = SaturationPouli(C_TMO_prime, imgTMO_ICh(:,:,1));
r = r1 ./ r2; %final scale
imgTMO_ICh(:,:,2) = r .* C_TMO_prime; %final scale
imgTMO_ICh(:,:,3) = imgHDR_ICh(:,:,3); %same hue of HDR

%conversion from IPT to XYZ
imgTMO_c_IPT = ConvertIPTtoICh(imgTMO_ICh, 1);
%conversion from IPT to XYZ
imgTMO_c_XYZ = ConvertXYZtoIPT(imgTMO_c_IPT, 1);
%conversion from XYZ to RGB
imgTMO_c = ConvertRGBtoXYZ(imgTMO_c_XYZ, 1);

end

{'repo_name': 'banterle/HDR_Toolbox', 'stars': '198', 'repo_language': 'MATLAB', 'file_name': 'demo_environment_maps.m', 'mime_type': 'text/plain', 'hash': 7810294094461783009, 'source_dataset': 'data'}